r24893 by jghali - Qt6: fix scrolling and zooming with mouse wheel
scribus-commit
scribus-commit at lists.scribus.net
Thu Feb 3 21:52:43 UTC 2022
Author: jghali
Date: Thu Feb 3 21:52:43 2022
New Revision: 24893
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24893
Log:
Qt6: fix scrolling and zooming with mouse wheel
Modified:
trunk/Scribus/scribus/scribusview.cpp
Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24893&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp (original)
+++ trunk/Scribus/scribus/scribusview.cpp Thu Feb 3 21:52:43 2022
@@ -51,6 +51,7 @@
#include <cstdio>
#include <cstdlib>
+#include <utility>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
@@ -3201,19 +3202,20 @@
void ScribusView::wheelEvent(QWheelEvent *w)
{
+ QPoint angleDelta = w->angleDelta();
if (w->modifiers() == Qt::ControlModifier)
{
FPoint mp = m_canvas->globalToCanvas(w->globalPosition());
- w->angleDelta().x() > 0 ? slotZoomIn(mp.x(), mp.y() , true) : slotZoomOut(mp.x(), mp.y(), true);
+ angleDelta.y() > 0 ? slotZoomIn(mp.x(), mp.y(), true) : slotZoomOut(mp.x(), mp.y(), true);
}
else
{
- int dX = 0, dY = 0;
- int moveBy = (w->angleDelta().x() < 0) ? Prefs->uiPrefs.wheelJump : -Prefs->uiPrefs.wheelJump;
- if ((w->angleDelta().y()==0) || ( w->modifiers() == Qt::ShiftModifier ))
- dX = moveBy;
- else
- dY = moveBy;
+ int signOfX = (angleDelta.x() > 0) ? 1 : ((angleDelta.x() < 0) ? -1 : 0);
+ int signOfY = (angleDelta.y() > 0) ? 1 : ((angleDelta.y() < 0) ? -1 : 0);
+ int dX = -Prefs->uiPrefs.wheelJump * signOfX;
+ int dY = -Prefs->uiPrefs.wheelJump * signOfY;
+ if (w->modifiers() == Qt::ShiftModifier)
+ std::swap(dX, dY);
scrollBy(dX, dY);
}
w->accept();
More information about the scribus-commit
mailing list