diff --git a/app/configdialog.cpp b/app/configdialog.cpp --- a/app/configdialog.cpp +++ b/app/configdialog.cpp @@ -76,6 +76,7 @@ mWheelBehaviorGroup->setObjectName(QLatin1String("kcfg_MouseWheelBehavior")); mWheelBehaviorGroup->addButton(mImageViewConfigPage.mouseWheelScrollRadioButton, int(MouseWheelBehavior::Scroll)); mWheelBehaviorGroup->addButton(mImageViewConfigPage.mouseWheelBrowseRadioButton, int(MouseWheelBehavior::Browse)); + mWheelBehaviorGroup->addButton(mImageViewConfigPage.mouseWheelZoomRadioButton, int(MouseWheelBehavior::Zoom)); mAnimationMethodGroup = new InvisibleButtonGroup(widget); mAnimationMethodGroup->setObjectName(QLatin1String("kcfg_AnimationMethod")); diff --git a/app/imageviewconfigpage.ui b/app/imageviewconfigpage.ui --- a/app/imageviewconfigpage.ui +++ b/app/imageviewconfigpage.ui @@ -211,6 +211,30 @@ + + + + + Zoom + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + Qt::Vertical @@ -226,7 +250,7 @@ - + Zoom mode: @@ -239,7 +263,7 @@ - + @@ -266,7 +290,7 @@ - + @@ -290,7 +314,7 @@ - + @@ -314,7 +338,7 @@ - + Qt::Vertical @@ -330,7 +354,7 @@ - + @@ -354,7 +378,7 @@ - + Qt::Vertical @@ -370,7 +394,7 @@ - + Animations: @@ -383,7 +407,7 @@ - + @@ -410,7 +434,7 @@ - + @@ -434,7 +458,7 @@ - + @@ -458,7 +482,7 @@ - + Qt::Vertical @@ -474,14 +498,14 @@ - + <b>Thumbnail Bar</b> - + Qt::Vertical @@ -497,7 +521,7 @@ - + Orientation: @@ -510,7 +534,7 @@ - + @@ -534,7 +558,7 @@ - + @@ -558,7 +582,7 @@ - + Row count: @@ -571,7 +595,7 @@ - + @@ -598,7 +622,7 @@ - + Qt::Vertical @@ -631,6 +655,7 @@ kcfg_AlphaBackgroundColor mouseWheelScrollRadioButton mouseWheelBrowseRadioButton + mouseWheelZoomRadioButton kcfg_EnlargeSmallerImages glAnimationRadioButton softwareAnimationRadioButton diff --git a/lib/documentview/documentview.cpp b/lib/documentview/documentview.cpp --- a/lib/documentview/documentview.cpp +++ b/lib/documentview/documentview.cpp @@ -732,17 +732,21 @@ void DocumentView::wheelEvent(QGraphicsSceneWheelEvent* event) { - if (d->mAdapter->canZoom() && event->modifiers() & Qt::ControlModifier) { - d->controlWheelAccumulatedDelta += event->delta(); - // Ctrl + wheel => zoom in or out - if (d->controlWheelAccumulatedDelta >= QWheelEvent::DefaultDeltasPerStep) { - zoomIn(event->pos()); - d->controlWheelAccumulatedDelta = 0; - } else if (d->controlWheelAccumulatedDelta <= -QWheelEvent::DefaultDeltasPerStep) { - zoomOut(event->pos()); - d->controlWheelAccumulatedDelta = 0; + if (d->mAdapter->canZoom()) { + if ((event->modifiers() & Qt::ControlModifier) || + (GwenviewConfig::mouseWheelBehavior() == MouseWheelBehavior::Zoom + && event->modifiers() == Qt::NoModifier)) { + d->controlWheelAccumulatedDelta += event->delta(); + // Ctrl + wheel => zoom in or out + if (d->controlWheelAccumulatedDelta >= QWheelEvent::DefaultDeltasPerStep) { + zoomIn(event->pos()); + d->controlWheelAccumulatedDelta = 0; + } else if (d->controlWheelAccumulatedDelta <= -QWheelEvent::DefaultDeltasPerStep) { + zoomOut(event->pos()); + d->controlWheelAccumulatedDelta = 0; + } + return; } - return; } if (GwenviewConfig::mouseWheelBehavior() == MouseWheelBehavior::Browse && event->modifiers() == Qt::NoModifier) { diff --git a/lib/gwenviewconfig.kcfg b/lib/gwenviewconfig.kcfg --- a/lib/gwenviewconfig.kcfg +++ b/lib/gwenviewconfig.kcfg @@ -136,6 +136,7 @@ + MouseWheelBehavior::Scroll diff --git a/lib/mousewheelbehavior.h b/lib/mousewheelbehavior.h --- a/lib/mousewheelbehavior.h +++ b/lib/mousewheelbehavior.h @@ -34,7 +34,8 @@ { enum Enum { Scroll, - Browse + Browse, + Zoom }; } // namespace MouseWheelBehavior