Changeset View
Changeset View
Standalone View
Standalone View
lib/documentview/documentview.cpp
Show First 20 Lines • Show All 726 Lines • ▼ Show 20 Line(s) | 724 | if (d->mAdapter->canZoom() && event->button() == Qt::MiddleButton) { | |||
---|---|---|---|---|---|
727 | } else if (event->modifiers() == Qt::SHIFT) { | 727 | } else if (event->modifiers() == Qt::SHIFT) { | ||
728 | toggleZoomToFill(); | 728 | toggleZoomToFill(); | ||
729 | } | 729 | } | ||
730 | } | 730 | } | ||
731 | } | 731 | } | ||
732 | 732 | | |||
733 | void DocumentView::wheelEvent(QGraphicsSceneWheelEvent* event) | 733 | void DocumentView::wheelEvent(QGraphicsSceneWheelEvent* event) | ||
734 | { | 734 | { | ||
735 | if (d->mAdapter->canZoom() && event->modifiers() & Qt::ControlModifier) { | 735 | if (d->mAdapter->canZoom()) { | ||
736 | if ((event->modifiers() & Qt::ControlModifier) || | ||||
muhlenpfordt: If `MouseWheelBehavior::Zoom` is active the zoom part is called no matter what `canZoom()`… | |||||
737 | (GwenviewConfig::mouseWheelBehavior() == MouseWheelBehavior::Zoom | ||||
738 | && event->modifiers() == Qt::NoModifier)) { | ||||
736 | d->controlWheelAccumulatedDelta += event->delta(); | 739 | d->controlWheelAccumulatedDelta += event->delta(); | ||
737 | // Ctrl + wheel => zoom in or out | 740 | // Ctrl + wheel => zoom in or out | ||
738 | if (d->controlWheelAccumulatedDelta >= QWheelEvent::DefaultDeltasPerStep) { | 741 | if (d->controlWheelAccumulatedDelta >= QWheelEvent::DefaultDeltasPerStep) { | ||
739 | zoomIn(event->pos()); | 742 | zoomIn(event->pos()); | ||
740 | d->controlWheelAccumulatedDelta = 0; | 743 | d->controlWheelAccumulatedDelta = 0; | ||
741 | } else if (d->controlWheelAccumulatedDelta <= -QWheelEvent::DefaultDeltasPerStep) { | 744 | } else if (d->controlWheelAccumulatedDelta <= -QWheelEvent::DefaultDeltasPerStep) { | ||
742 | zoomOut(event->pos()); | 745 | zoomOut(event->pos()); | ||
743 | d->controlWheelAccumulatedDelta = 0; | 746 | d->controlWheelAccumulatedDelta = 0; | ||
744 | } | 747 | } | ||
745 | return; | 748 | return; | ||
746 | } | 749 | } | ||
750 | } | ||||
747 | if (GwenviewConfig::mouseWheelBehavior() == MouseWheelBehavior::Browse | 751 | if (GwenviewConfig::mouseWheelBehavior() == MouseWheelBehavior::Browse | ||
748 | && event->modifiers() == Qt::NoModifier) { | 752 | && event->modifiers() == Qt::NoModifier) { | ||
749 | d->controlWheelAccumulatedDelta += event->delta(); | 753 | d->controlWheelAccumulatedDelta += event->delta(); | ||
750 | // Browse with mouse wheel | 754 | // Browse with mouse wheel | ||
751 | if (d->controlWheelAccumulatedDelta >= QWheelEvent::DefaultDeltasPerStep) { | 755 | if (d->controlWheelAccumulatedDelta >= QWheelEvent::DefaultDeltasPerStep) { | ||
752 | emit previousImageRequested(); | 756 | emit previousImageRequested(); | ||
753 | d->controlWheelAccumulatedDelta = 0; | 757 | d->controlWheelAccumulatedDelta = 0; | ||
754 | } else if (d->controlWheelAccumulatedDelta <= -QWheelEvent::DefaultDeltasPerStep) { | 758 | } else if (d->controlWheelAccumulatedDelta <= -QWheelEvent::DefaultDeltasPerStep) { | ||
▲ Show 20 Lines • Show All 264 Lines • Show Last 20 Lines |
If MouseWheelBehavior::Zoom is active the zoom part is called no matter what canZoom() returns (e.g. for videos this is false). I can't see any problem ATM but maybe we should respect canZoom().