diff options
| author | Frank Reininghaus <[email protected]> | 2009-10-25 10:41:15 +0000 |
|---|---|---|
| committer | Frank Reininghaus <[email protected]> | 2009-10-25 10:41:15 +0000 |
| commit | 499e8723f4b82ed1e9abbee91594ab8170421e11 (patch) | |
| tree | 1dd1428c806993fd5dcc41a0f41bda5ae7f32017 /src/dolphinview.cpp | |
| parent | 9c2f205a097e043a6ea301d4e17802507c35d4d0 (diff) | |
Do not zoom the icons if the user presses Control and the left mouse
button while using the mouse wheel. The user is probably trying to
scroll the view during a rubberband selection in that case.
Also simplify the code a bit by handling the icon zooming in
DolphinView::eventFilter().
BUG: 190703
svn path=/trunk/KDE/kdebase/apps/; revision=1040021
Diffstat (limited to 'src/dolphinview.cpp')
| -rw-r--r-- | src/dolphinview.cpp | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp index a49aabdd9..034b81d3f 100644 --- a/src/dolphinview.cpp +++ b/src/dolphinview.cpp @@ -831,20 +831,6 @@ void DolphinView::mouseReleaseEvent(QMouseEvent* event) setActive(true); } -void DolphinView::wheelEvent(QWheelEvent* event) -{ - if (event->modifiers() & Qt::ControlModifier) { - const int delta = event->delta(); - const int level = zoomLevel(); - if (delta > 0) { - setZoomLevel(level + 1); - } else if (delta < 0) { - setZoomLevel(level - 1); - } - event->accept(); - } -} - bool DolphinView::eventFilter(QObject* watched, QEvent* event) { switch (event->type()) { @@ -870,6 +856,24 @@ bool DolphinView::eventFilter(QObject* watched, QEvent* event) } break; + case QEvent::Wheel: + if (watched == m_viewAccessor.itemView()->viewport()) { + // Ctrl+wheel events should cause icon zooming, but not if the left mouse button is pressed + // (the user is probably trying to scroll during a selection in that case) + QWheelEvent* wheelEvent = static_cast<QWheelEvent*>(event); + if (wheelEvent->modifiers() & Qt::ControlModifier && !(wheelEvent->buttons() & Qt::LeftButton)) { + const int delta = wheelEvent->delta(); + const int level = zoomLevel(); + if (delta > 0) { + setZoomLevel(level + 1); + } else if (delta < 0) { + setZoomLevel(level - 1); + } + return true; + } + } + break; + default: break; } |
