Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit c4a84dad authored by Thomas Mitterfellner's avatar Thomas Mitterfellner Committed by Albert Astals Cid

Reduce hyper-sensitive touchpad scroll-zoom speed

Summary:
BUG: 378584

Reduce hyper-sensitive touchpad scroll-zoom speed in Gwenview

Test Plan: Submitting this on behalf of  Thomas Mitterfellner since he's having trouble with his Phabricator access. Patch is  modeled after Albert's similar patch for Okular in https://cgit.kde.org/okular.git/commit/?id=7a50ce0edfc9be8bd23441e52a4f3a0c60f7e60f. Thomas has tested locally with a touchpad and scroll wheel, and I have tested in a KDE Neon VM. Seems to work as expected.

Reviewers: #kde_applications, broulik, aacid

Reviewed By: #kde_applications, aacid

Differential Revision: https://phabricator.kde.org/D7744
parent a930fb54
......@@ -95,6 +95,7 @@ struct DocumentViewPrivate
bool mCurrent;
bool mCompareMode;
bool mEraseBorders;
int controlWheelAccumulatedDelta;
void setCurrentAdapter(AbstractDocumentViewAdapter* adapter)
{
......@@ -342,6 +343,7 @@ DocumentView::DocumentView(QGraphicsScene* scene)
d->mCurrent = false;
d->mCompareMode = false;
d->mEraseBorders = false;
d->controlWheelAccumulatedDelta = 0;
setOpacity(0);
......@@ -573,11 +575,14 @@ qreal DocumentView::zoom() const
void DocumentView::wheelEvent(QGraphicsSceneWheelEvent* event)
{
if (d->mAdapter->canZoom() && event->modifiers() & Qt::ControlModifier) {
d->controlWheelAccumulatedDelta += event->delta();
// Ctrl + wheel => zoom in or out
if (event->delta() > 0) {
if (d->controlWheelAccumulatedDelta >= QWheelEvent::DefaultDeltasPerStep) {
zoomIn(event->pos());
} else {
d->controlWheelAccumulatedDelta = 0;
} else if (d->controlWheelAccumulatedDelta <= -QWheelEvent::DefaultDeltasPerStep) {
zoomOut(event->pos());
d->controlWheelAccumulatedDelta = 0;
}
return;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment