Merge pull request #708 from openscad/zoompeace

Zoompeace
master
Marius Kintel 2014-03-30 19:09:27 +02:00
commit 0e9d06669e
4 changed files with 85 additions and 19 deletions

View File

@ -65,6 +65,12 @@ Preferences::Preferences(QWidget *parent) : QMainWindow(parent)
this->defaultmap["editor/fontsize"] = 12;
this->defaultmap["editor/syntaxhighlight"] = "For Light Background";
#if defined (Q_OS_MAC)
this->defaultmap["editor/ctrlmousewheelzoom"] = false;
#else
this->defaultmap["editor/ctrlmousewheelzoom"] = true;
#endif
uint savedsize = getValue("editor/fontsize").toUInt();
QFontDatabase db;
foreach(uint size, db.standardSizes()) {
@ -373,6 +379,12 @@ void Preferences::on_forceGoldfeatherBox_toggled(bool state)
emit openCSGSettingsChanged();
}
void Preferences::on_mouseWheelZoomBox_toggled(bool state)
{
QSettings settings;
settings.setValue("editor/ctrlmousewheelzoom", state);
}
void Preferences::keyPressEvent(QKeyEvent *e)
{
#ifdef Q_OS_MAC
@ -435,6 +447,8 @@ void Preferences::updateGUI()
int shidx = this->syntaxHighlight->findText(shighlight);
if (shidx >= 0) this->syntaxHighlight->setCurrentIndex(shidx);
this->mouseWheelZoomBox->setChecked(getValue("editor/ctrlmousewheelzoom").toBool());
if (AutoUpdater *updater = AutoUpdater::updater()) {
this->updateCheckBox->setChecked(updater->automaticallyChecksForUpdates());
this->snapshotCheckBox->setChecked(updater->enableSnapshots());

View File

@ -32,6 +32,7 @@ public slots:
void on_polysetCacheSizeEdit_textChanged(const QString &);
void on_opencsgLimitEdit_textChanged(const QString &);
void on_forceGoldfeatherBox_toggled(bool);
void on_mouseWheelZoomBox_toggled(bool);
void on_updateCheckBox_toggled(bool);
void on_snapshotCheckBox_toggled(bool);
void on_checkNowButton_clicked();

View File

@ -165,7 +165,7 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<layout class="QHBoxLayout" name="syntaxHighlightLayout">
<property name="bottomMargin">
<number>0</number>
</property>
@ -182,24 +182,14 @@
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Maximum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>30</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QComboBox" name="syntaxHighlight">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>For Light Background</string>
@ -217,6 +207,62 @@
</item>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>30</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="mouseWheelZoomLayout">
<property name="topMargin">
<number>5</number>
</property>
<item>
<widget class="QLabel" name="label_11">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Use Ctrl/Cmd-Mouse-wheel to zoom text</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="mouseWheelZoomBox">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
@ -417,8 +463,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>98</width>
<height>36</height>
<width>803</width>
<height>325</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_10">

View File

@ -104,6 +104,11 @@ void Editor::zoomOut()
void Editor::wheelEvent ( QWheelEvent * event )
{
QSettings settings;
if (!Preferences::inst()->getValue("editor/ctrlmousewheelzoom").toBool()) {
return;
// see numerous bug reports on mailing list
}
if (event->modifiers() == Qt::ControlModifier) {
if (event->delta() > 0 )
zoomIn();