Commit 0755b736 authored by Aleks Kissinger's avatar Aleks Kissinger

made hold shift to scroll a preference (closes #53)

parent b1e45798
...@@ -31,6 +31,7 @@ PreferenceDialog::PreferenceDialog(QWidget *parent) : ...@@ -31,6 +31,7 @@ PreferenceDialog::PreferenceDialog(QWidget *parent) :
connect(ui->minorColor, SIGNAL(clicked()), this, SLOT(colorClick())); connect(ui->minorColor, SIGNAL(clicked()), this, SLOT(colorClick()));
ui->selectNewEdges->setChecked(settings.value("select-new-edges", false).toBool()); ui->selectNewEdges->setChecked(settings.value("select-new-edges", false).toBool());
ui->shiftToScroll->setChecked(settings.value("shift-to-scroll", false).toBool());
} }
PreferenceDialog::~PreferenceDialog() PreferenceDialog::~PreferenceDialog()
...@@ -47,6 +48,7 @@ void PreferenceDialog::accept() ...@@ -47,6 +48,7 @@ void PreferenceDialog::accept()
settings.setValue("grid-color-major", color(ui->majorColor)); settings.setValue("grid-color-major", color(ui->majorColor));
settings.setValue("grid-color-minor", color(ui->minorColor)); settings.setValue("grid-color-minor", color(ui->minorColor));
settings.setValue("select-new-edges", ui->selectNewEdges->isChecked()); settings.setValue("select-new-edges", ui->selectNewEdges->isChecked());
settings.setValue("shift-to-scroll", ui->shiftToScroll->isChecked());
QDialog::accept(); QDialog::accept();
} }
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_3">
<property name="text"> <property name="text">
<string>Grid colors</string> <string>Grid Colors</string>
</property> </property>
</widget> </widget>
</item> </item>
...@@ -220,17 +220,24 @@ ...@@ -220,17 +220,24 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0"> <item row="5" column="0">
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_2">
<property name="text"> <property name="text">
<string>Auto-select new edges</string> <string>UI Options</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="1"> <item row="5" column="1">
<widget class="QCheckBox" name="selectNewEdges"> <widget class="QCheckBox" name="selectNewEdges">
<property name="text"> <property name="text">
<string/> <string>Auto-select new edges</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QCheckBox" name="shiftToScroll">
<property name="text">
<string>Hold shift to scroll with wheel or touchpad</string>
</property> </property>
</widget> </widget>
</item> </item>
......
...@@ -134,10 +134,16 @@ void TikzView::drawBackground(QPainter *painter, const QRectF &rect) ...@@ -134,10 +134,16 @@ void TikzView::drawBackground(QPainter *painter, const QRectF &rect)
void TikzView::wheelEvent(QWheelEvent *event) void TikzView::wheelEvent(QWheelEvent *event)
{ {
if (event->modifiers() & Qt::ShiftModifier) { QSettings settings("tikzit", "tikzit");
bool shiftScroll = settings.value("shift-to-scroll", false).toBool();
if ((!shiftScroll && event->modifiers() == Qt::NoModifier) ||
(shiftScroll && (event->modifiers() == Qt::ShiftModifier)))
{
event->setModifiers(Qt::NoModifier); event->setModifiers(Qt::NoModifier);
QGraphicsView::wheelEvent(event); QGraphicsView::wheelEvent(event);
} else if (event->modifiers() & Qt::ControlModifier) { }
if (event->modifiers() & Qt::ControlModifier) {
if (event->angleDelta().y() > 0) { if (event->angleDelta().y() > 0) {
zoomIn(); zoomIn();
} else if (event->angleDelta().y() < 0) { } else if (event->angleDelta().y() < 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment