From 215934254c3a80d8b30858f8c273a329c817a7f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Thu, 25 Jan 2018 17:15:31 +0100 Subject: Implement angle scroll This is not tested as I don't have any device that reports as an angle scroll (meaby feature of X server). For future if on some other platfrom this is the problem then ANGLE_SCROLL variable should be tweaked. --- qtmips_gui/memoryview.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'qtmips_gui') diff --git a/qtmips_gui/memoryview.cpp b/qtmips_gui/memoryview.cpp index 7bd66cd..48882db 100644 --- a/qtmips_gui/memoryview.cpp +++ b/qtmips_gui/memoryview.cpp @@ -5,6 +5,8 @@ #define MIN_OFF 10 // Focus point (this is multiplied with height of widget to know position where we want to focus) #define FOCUS 0.25 +// How angle maps to pixels when and scroll is used +#define ANGLE_SCROLL 4 /////////////////////////// MemoryView::MemoryView(QWidget *parent) : QWidget(parent) { @@ -178,8 +180,9 @@ void MemoryView::Frame::wheelEvent(QWheelEvent *e) { QPoint ang = e->angleDelta(); if (!pix.isNull()) - content_y += e->pixelDelta().ry(); - // TODO angle scroll + content_y += pix.ry(); + else if (!ang.isNull()) + content_y += ang.ry() * ANGLE_SCROLL; // TODO smooth scroll viewport()->move(0, content_y); -- cgit v1.2.3