┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Reininghaus <[email protected]>2011-10-15 20:08:42 +0200
committerFrank Reininghaus <[email protected]>2011-10-15 20:08:42 +0200
commita49109b09a191b73f3fda8b65c29e9c6c9bd33d8 (patch)
tree2474c25dfc76192a1dd816887c4640c3da1214d3
parent1abb47fba752e16b9a7d4fb8f483b239749c5f4d (diff)
Fix regression concerning Control+mouse wheel zooming
Commit 9311f4bc97ec7000be46b8eec242a8 accidentally removed DolphinView::wheelEvent(), which is responsible for the handling of Control+mouse wheel events. These should change the zoom level.
-rw-r--r--src/views/dolphinview.cpp13
-rw-r--r--src/views/dolphinview.h4
2 files changed, 17 insertions, 0 deletions
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp
index f2f434f46..2bd95767a 100644
--- a/src/views/dolphinview.cpp
+++ b/src/views/dolphinview.cpp
@@ -712,6 +712,19 @@ bool DolphinView::eventFilter(QObject* watched, QEvent* event)
return QWidget::eventFilter(watched, event);
}
+void DolphinView::wheelEvent(QWheelEvent* event)
+{
+ if (event->modifiers().testFlag(Qt::ControlModifier)) {
+ const int numDegrees = event->delta() / 8;
+ const int numSteps = numDegrees / 15;
+
+ setZoomLevel(zoomLevel() + numSteps);
+ event->accept();
+ } else {
+ event->ignore();
+ }
+}
+
void DolphinView::activate()
{
setActive(true);
diff --git a/src/views/dolphinview.h b/src/views/dolphinview.h
index c3981bef4..770bbde72 100644
--- a/src/views/dolphinview.h
+++ b/src/views/dolphinview.h
@@ -553,6 +553,10 @@ signals:
*/
void writeStateChanged(bool isFolderWritable);
+protected:
+ /** Changes the zoom level if Control is pressed during a wheel event. */
+ virtual void wheelEvent(QWheelEvent* event);
+
private slots:
/**
* Marks the view as active (DolphinView:isActive() will return true)