Support graph and disassembly scrolling via PgUp and PgDown

This commit is contained in:
Rohit Bisht 2023-01-19 07:19:54 +05:30 committed by GitHub
parent 3921ba172e
commit 5144c3f3b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -703,7 +703,10 @@ void GraphView::mouseDoubleClickEvent(QMouseEvent *event)
void GraphView::keyPressEvent(QKeyEvent *event) void GraphView::keyPressEvent(QKeyEvent *event)
{ {
// for scrolling with arrow keys
const int delta = static_cast<int>(30.0 / current_scale); const int delta = static_cast<int>(30.0 / current_scale);
// for scrolling with pgup/pgdown keys
const int delta2 = static_cast<int>(100.0 / current_scale);
int dx = 0, dy = 0; int dx = 0, dy = 0;
switch (event->key()) { switch (event->key()) {
case Qt::Key_Up: case Qt::Key_Up:
@ -718,6 +721,12 @@ void GraphView::keyPressEvent(QKeyEvent *event)
case Qt::Key_Right: case Qt::Key_Right:
dx = delta; dx = delta;
break; break;
case Qt::Key_PageUp:
dy = -delta2;
break;
case Qt::Key_PageDown:
dy = delta2;
break;
default: default:
QAbstractScrollArea::keyPressEvent(event); QAbstractScrollArea::keyPressEvent(event);
return; return;