aboutsummaryrefslogtreecommitdiff
path: root/qtmips_gui/memoryview.cpp
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2018-01-25 17:15:31 +0100
committerKarel Kočí <cynerd@email.cz>2018-01-25 17:17:11 +0100
commit215934254c3a80d8b30858f8c273a329c817a7f9 (patch)
treec16169ecd2c037c8c73b532d8e78bf1d05a00a38 /qtmips_gui/memoryview.cpp
parenteea2dd30f5fbc770b3a95d8330b3b88615974382 (diff)
downloadqtmips-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.
Diffstat (limited to 'qtmips_gui/memoryview.cpp')
-rw-r--r--qtmips_gui/memoryview.cpp7
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);