mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-19 19:36:11 +00:00
Add scrolling to DisassemblyWidget left panel
This commit is contained in:
parent
4b9a4ff2e2
commit
736d3e1f1d
@ -79,7 +79,7 @@ DisassemblyWidget::DisassemblyWidget(MainWindow *main, QAction *action)
|
||||
mDisasScrollArea->setFocusPolicy(Qt::ClickFocus);
|
||||
|
||||
setFocusPolicy(Qt::ClickFocus);
|
||||
|
||||
|
||||
// Behave like all widgets: highlight on focus and hover
|
||||
connect(qApp, &QApplication::focusChanged, this, [this](QWidget* , QWidget* now) {
|
||||
QColor borderColor = this == now
|
||||
@ -217,7 +217,7 @@ DisassemblyWidget::DisassemblyWidget(MainWindow *main, QAction *action)
|
||||
ADD_ACTION(QKeySequence::MoveToPreviousPage, Qt::WidgetWithChildrenShortcut, [this]() {
|
||||
moveCursorRelative(true, true);
|
||||
})
|
||||
|
||||
|
||||
// Plus sign in num-bar considered "Qt::Key_Equal"
|
||||
ADD_ACTION(QKeySequence(Qt::CTRL + Qt::Key_Equal), Qt::WidgetWithChildrenShortcut, &DisassemblyWidget::zoomIn)
|
||||
// Plus sign in numpad
|
||||
@ -813,6 +813,13 @@ DisassemblyLeftPanel::DisassemblyLeftPanel(DisassemblyWidget *disas)
|
||||
this->disas = disas;
|
||||
}
|
||||
|
||||
void DisassemblyLeftPanel::wheelEvent(QWheelEvent *event) {
|
||||
int count = -(event->angleDelta() / 15).y();
|
||||
count -= (count > 0 ? 5 : -5);
|
||||
|
||||
this->disas->scrollInstructions(count);
|
||||
}
|
||||
|
||||
void DisassemblyLeftPanel::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
|
@ -32,6 +32,7 @@ public slots:
|
||||
void showDisasContextMenu(const QPoint &pt);
|
||||
void fontsUpdatedSlot();
|
||||
void colorsUpdatedSlot();
|
||||
void scrollInstructions(int count);
|
||||
void seekPrev();
|
||||
void setPreviewMode(bool previewMode);
|
||||
QFontMetrics getFontMetrics();
|
||||
@ -41,7 +42,6 @@ protected slots:
|
||||
void on_seekChanged(RVA offset);
|
||||
void refreshDisasm(RVA offset = RVA_INVALID);
|
||||
|
||||
void scrollInstructions(int count);
|
||||
bool updateMaxLines();
|
||||
|
||||
void cursorPositionChanged();
|
||||
@ -143,6 +143,7 @@ class DisassemblyLeftPanel: public QFrame
|
||||
public:
|
||||
DisassemblyLeftPanel(DisassemblyWidget *disas);
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
void wheelEvent(QWheelEvent *event) override;
|
||||
|
||||
private:
|
||||
DisassemblyWidget *disas;
|
||||
|
Loading…
Reference in New Issue
Block a user