diff options
author | Karel Kočí <cynerd@email.cz> | 2018-01-25 17:15:31 +0100 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2018-01-25 17:17:11 +0100 |
commit | 215934254c3a80d8b30858f8c273a329c817a7f9 (patch) | |
tree | c16169ecd2c037c8c73b532d8e78bf1d05a00a38 | |
parent | eea2dd30f5fbc770b3a95d8330b3b88615974382 (diff) | |
download | qtmips-215934254c3a80d8b30858f8c273a329c817a7f9.tar.gz qtmips-215934254c3a80d8b30858f8c273a329c817a7f9.tar.bz2 qtmips-215934254c3a80d8b30858f8c273a329c817a7f9.zip |
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.
-rw-r--r-- | qtmips_gui/memoryview.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
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); |