mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-18 19:06:10 +00:00
Qt6 keyboard and mouse API compatibility
* Some of the API replaced int with QKeyCombination, use typedef in cutter code * Use of + operator depracted, replace with recommended "|" operator * QMouseEvent globalPos and localPos renamed to globalPosition and position, replace with helper function or use of integer position which wasn't renamed.
This commit is contained in:
parent
2799390314
commit
585dc961db
@ -286,4 +286,23 @@ bool filterStringContains(const QString &string, const QSortFilterProxyModel *mo
|
|||||||
return string.contains(model->filterRegularExpression());
|
return string.contains(model->filterRegularExpression());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QPointF mouseEventPos(QMouseEvent *ev)
|
||||||
|
{
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
|
return ev->localPos();
|
||||||
|
#else
|
||||||
|
return ev->position();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
QPoint mouseEventGlobalPos(QMouseEvent *ev)
|
||||||
|
{
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
|
return ev->globalPos();
|
||||||
|
#else
|
||||||
|
return ev->globalPosition().toPoint();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
} // end namespace
|
} // end namespace
|
||||||
|
@ -24,6 +24,7 @@ class QMenu;
|
|||||||
class QPaintDevice;
|
class QPaintDevice;
|
||||||
class QComboBox;
|
class QComboBox;
|
||||||
class QSortFilterProxyModel;
|
class QSortFilterProxyModel;
|
||||||
|
class QMouseEvent;
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
||||||
# define CUTTER_QT_SKIP_EMPTY_PARTS QString::SkipEmptyParts
|
# define CUTTER_QT_SKIP_EMPTY_PARTS QString::SkipEmptyParts
|
||||||
@ -88,9 +89,15 @@ CUTTER_EXPORT bool filterStringContains(const QString &string, const QSortFilter
|
|||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
using ColorFloat = float;
|
using ColorFloat = float;
|
||||||
|
using KeyComb = QKeyCombination;
|
||||||
#else
|
#else
|
||||||
using ColorFloat = qreal;
|
using ColorFloat = qreal;
|
||||||
|
using KeyComb = int;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
CUTTER_EXPORT QPointF mouseEventPos(QMouseEvent *ev);
|
||||||
|
CUTTER_EXPORT QPoint mouseEventGlobalPos(QMouseEvent *ev);
|
||||||
|
|
||||||
} // qhelpers
|
} // qhelpers
|
||||||
|
|
||||||
#endif // HELPERS_H
|
#endif // HELPERS_H
|
||||||
|
@ -20,7 +20,7 @@ AddressableItemContextMenu::AddressableItemContextMenu(QWidget *parent, MainWind
|
|||||||
|
|
||||||
connect(actionCopyAddress, &QAction::triggered, this,
|
connect(actionCopyAddress, &QAction::triggered, this,
|
||||||
&AddressableItemContextMenu::onActionCopyAddress);
|
&AddressableItemContextMenu::onActionCopyAddress);
|
||||||
actionCopyAddress->setShortcuts({ Qt::CTRL + Qt::SHIFT + Qt::Key_C });
|
actionCopyAddress->setShortcuts({ Qt::CTRL | Qt::SHIFT | Qt::Key_C });
|
||||||
actionCopyAddress->setShortcutContext(Qt::ShortcutContext::WidgetWithChildrenShortcut);
|
actionCopyAddress->setShortcutContext(Qt::ShortcutContext::WidgetWithChildrenShortcut);
|
||||||
|
|
||||||
connect(actionShowXrefs, &QAction::triggered, this,
|
connect(actionShowXrefs, &QAction::triggered, this,
|
||||||
|
@ -275,7 +275,8 @@ void DecompilerContextMenu::setActionCopy() // Set all three copy actions
|
|||||||
connect(&actionCopyReferenceAddress, &QAction::triggered, this,
|
connect(&actionCopyReferenceAddress, &QAction::triggered, this,
|
||||||
&DecompilerContextMenu::actionCopyReferenceAddressTriggered);
|
&DecompilerContextMenu::actionCopyReferenceAddressTriggered);
|
||||||
addAction(&actionCopyReferenceAddress);
|
addAction(&actionCopyReferenceAddress);
|
||||||
actionCopyReferenceAddress.setShortcut({ Qt::CTRL + Qt::SHIFT + Qt::Key_C });
|
actionCopyReferenceAddress.setShortcut({ Qt::KeyboardModifier::ControlModifier
|
||||||
|
| Qt::KeyboardModifier::ControlModifier | Qt::Key_C });
|
||||||
}
|
}
|
||||||
|
|
||||||
void DecompilerContextMenu::setActionShowInSubmenu()
|
void DecompilerContextMenu::setActionShowInSubmenu()
|
||||||
@ -339,14 +340,14 @@ void DecompilerContextMenu::setActionToggleBreakpoint()
|
|||||||
{
|
{
|
||||||
connect(&actionToggleBreakpoint, &QAction::triggered, this,
|
connect(&actionToggleBreakpoint, &QAction::triggered, this,
|
||||||
&DecompilerContextMenu::actionToggleBreakpointTriggered);
|
&DecompilerContextMenu::actionToggleBreakpointTriggered);
|
||||||
actionToggleBreakpoint.setShortcuts({ Qt::Key_F2, Qt::CTRL + Qt::Key_B });
|
actionToggleBreakpoint.setShortcuts({ Qt::Key_F2, Qt::CTRL | Qt::Key_B });
|
||||||
}
|
}
|
||||||
|
|
||||||
void DecompilerContextMenu::setActionAdvancedBreakpoint()
|
void DecompilerContextMenu::setActionAdvancedBreakpoint()
|
||||||
{
|
{
|
||||||
connect(&actionAdvancedBreakpoint, &QAction::triggered, this,
|
connect(&actionAdvancedBreakpoint, &QAction::triggered, this,
|
||||||
&DecompilerContextMenu::actionAdvancedBreakpointTriggered);
|
&DecompilerContextMenu::actionAdvancedBreakpointTriggered);
|
||||||
actionAdvancedBreakpoint.setShortcut({ Qt::CTRL + Qt::Key_F2 });
|
actionAdvancedBreakpoint.setShortcut({ Qt::CTRL | Qt::Key_F2 });
|
||||||
}
|
}
|
||||||
|
|
||||||
void DecompilerContextMenu::setActionContinueUntil()
|
void DecompilerContextMenu::setActionContinueUntil()
|
||||||
|
@ -135,8 +135,7 @@ DisassemblyContextMenu::DisassemblyContextMenu(QWidget *parent, MainWindow *main
|
|||||||
addAction(&actionXRefs);
|
addAction(&actionXRefs);
|
||||||
|
|
||||||
initAction(&actionXRefsForVariables, tr("X-Refs for local variables"),
|
initAction(&actionXRefsForVariables, tr("X-Refs for local variables"),
|
||||||
SLOT(on_actionXRefsForVariables_triggered()),
|
SLOT(on_actionXRefsForVariables_triggered()), QKeySequence(Qt::SHIFT | Qt::Key_X));
|
||||||
QKeySequence({ Qt::SHIFT + Qt::Key_X }));
|
|
||||||
addAction(&actionXRefsForVariables);
|
addAction(&actionXRefsForVariables);
|
||||||
|
|
||||||
initAction(&actionDisplayOptions, tr("Show Options"), SLOT(on_actionDisplayOptions_triggered()),
|
initAction(&actionDisplayOptions, tr("Show Options"), SLOT(on_actionDisplayOptions_triggered()),
|
||||||
@ -302,7 +301,7 @@ void DisassemblyContextMenu::addBreakpointMenu()
|
|||||||
SLOT(on_actionAddBreakpoint_triggered()), getAddBPSequence());
|
SLOT(on_actionAddBreakpoint_triggered()), getAddBPSequence());
|
||||||
breakpointMenu->addAction(&actionAddBreakpoint);
|
breakpointMenu->addAction(&actionAddBreakpoint);
|
||||||
initAction(&actionAdvancedBreakpoint, tr("Advanced breakpoint"),
|
initAction(&actionAdvancedBreakpoint, tr("Advanced breakpoint"),
|
||||||
SLOT(on_actionAdvancedBreakpoint_triggered()), QKeySequence(Qt::CTRL + Qt::Key_F2));
|
SLOT(on_actionAdvancedBreakpoint_triggered()), QKeySequence(Qt::CTRL | Qt::Key_F2));
|
||||||
breakpointMenu->addAction(&actionAdvancedBreakpoint);
|
breakpointMenu->addAction(&actionAdvancedBreakpoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -675,7 +674,7 @@ QKeySequence DisassemblyContextMenu::getLinkTypeSequence() const
|
|||||||
|
|
||||||
QList<QKeySequence> DisassemblyContextMenu::getAddBPSequence() const
|
QList<QKeySequence> DisassemblyContextMenu::getAddBPSequence() const
|
||||||
{
|
{
|
||||||
return { Qt::Key_F2, Qt::CTRL + Qt::Key_B };
|
return { Qt::Key_F2, Qt::CTRL | Qt::Key_B };
|
||||||
}
|
}
|
||||||
|
|
||||||
QKeySequence DisassemblyContextMenu::getDefineNewFunctionSequence() const
|
QKeySequence DisassemblyContextMenu::getDefineNewFunctionSequence() const
|
||||||
@ -685,7 +684,7 @@ QKeySequence DisassemblyContextMenu::getDefineNewFunctionSequence() const
|
|||||||
|
|
||||||
QKeySequence DisassemblyContextMenu::getEditFunctionSequence() const
|
QKeySequence DisassemblyContextMenu::getEditFunctionSequence() const
|
||||||
{
|
{
|
||||||
return { Qt::SHIFT + Qt::Key_P };
|
return { Qt::SHIFT | Qt::Key_P };
|
||||||
}
|
}
|
||||||
|
|
||||||
QKeySequence DisassemblyContextMenu::getUndefineFunctionSequence() const
|
QKeySequence DisassemblyContextMenu::getUndefineFunctionSequence() const
|
||||||
|
@ -77,7 +77,7 @@ ConsoleWidget::ConsoleWidget(MainWindow *main)
|
|||||||
addAction(actionClear);
|
addAction(actionClear);
|
||||||
|
|
||||||
// Ctrl+l to clear the output
|
// Ctrl+l to clear the output
|
||||||
actionClear->setShortcut(Qt::CTRL + Qt::Key_L);
|
actionClear->setShortcut(Qt::CTRL | Qt::Key_L);
|
||||||
actionClear->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
actionClear->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
||||||
actions.append(actionClear);
|
actions.append(actionClear);
|
||||||
|
|
||||||
|
@ -10,9 +10,11 @@
|
|||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <QActionGroup>
|
#include <QActionGroup>
|
||||||
|
|
||||||
static const int KEY_ZOOM_IN = Qt::Key_Plus + Qt::ControlModifier;
|
static const qhelpers::KeyComb KEY_ZOOM_IN = Qt::Key_Plus | Qt::ControlModifier;
|
||||||
static const int KEY_ZOOM_OUT = Qt::Key_Minus + Qt::ControlModifier;
|
static const qhelpers::KeyComb KEY_ZOOM_IN2 =
|
||||||
static const int KEY_ZOOM_RESET = Qt::Key_Equal + Qt::ControlModifier;
|
Qt::Key_Plus | (Qt::ControlModifier | Qt::ShiftModifier);
|
||||||
|
static const qhelpers::KeyComb KEY_ZOOM_OUT = Qt::Key_Minus | Qt::ControlModifier;
|
||||||
|
static const qhelpers::KeyComb KEY_ZOOM_RESET = Qt::Key_Equal | Qt::ControlModifier;
|
||||||
|
|
||||||
static const uint64_t BITMPA_EXPORT_WARNING_SIZE = 32 * 1024 * 1024;
|
static const uint64_t BITMPA_EXPORT_WARNING_SIZE = 32 * 1024 * 1024;
|
||||||
|
|
||||||
@ -205,9 +207,9 @@ bool CutterGraphView::event(QEvent *event)
|
|||||||
switch (event->type()) {
|
switch (event->type()) {
|
||||||
case QEvent::ShortcutOverride: {
|
case QEvent::ShortcutOverride: {
|
||||||
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
|
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
|
||||||
int key = keyEvent->key() + keyEvent->modifiers();
|
qhelpers::KeyComb key = Qt::Key(keyEvent->key()) | keyEvent->modifiers();
|
||||||
if (key == KEY_ZOOM_OUT || key == KEY_ZOOM_RESET || key == KEY_ZOOM_IN
|
if (key == KEY_ZOOM_OUT || key == KEY_ZOOM_RESET || key == KEY_ZOOM_IN
|
||||||
|| (key == (KEY_ZOOM_IN | Qt::ShiftModifier))) {
|
|| key == KEY_ZOOM_IN2) {
|
||||||
event->accept();
|
event->accept();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -215,8 +217,8 @@ bool CutterGraphView::event(QEvent *event)
|
|||||||
}
|
}
|
||||||
case QEvent::KeyPress: {
|
case QEvent::KeyPress: {
|
||||||
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
|
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
|
||||||
int key = keyEvent->key() + keyEvent->modifiers();
|
qhelpers::KeyComb key = Qt::Key(keyEvent->key()) | keyEvent->modifiers();
|
||||||
if (key == KEY_ZOOM_IN || (key == (KEY_ZOOM_IN | Qt::ShiftModifier))) {
|
if (key == KEY_ZOOM_IN || key == KEY_ZOOM_IN2) {
|
||||||
zoomIn();
|
zoomIn();
|
||||||
return true;
|
return true;
|
||||||
} else if (key == KEY_ZOOM_OUT) {
|
} else if (key == KEY_ZOOM_OUT) {
|
||||||
|
@ -68,15 +68,15 @@ DebugActions::DebugActions(QToolBar *toolBar, MainWindow *main) : QObject(main),
|
|||||||
actionContinueUntilCall = new QAction(continueUCLabel, this);
|
actionContinueUntilCall = new QAction(continueUCLabel, this);
|
||||||
actionContinueUntilSyscall = new QAction(continueUSLabel, this);
|
actionContinueUntilSyscall = new QAction(continueUSLabel, this);
|
||||||
actionContinueBack = new QAction(continueBackIcon, continueBackLabel, this);
|
actionContinueBack = new QAction(continueBackIcon, continueBackLabel, this);
|
||||||
actionContinueBack->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_F5));
|
actionContinueBack->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_F5));
|
||||||
actionStep = new QAction(stepLabel, this);
|
actionStep = new QAction(stepLabel, this);
|
||||||
actionStep->setShortcut(QKeySequence(Qt::Key_F7));
|
actionStep->setShortcut(QKeySequence(Qt::Key_F7));
|
||||||
actionStepOver = new QAction(stepOverLabel, this);
|
actionStepOver = new QAction(stepOverLabel, this);
|
||||||
actionStepOver->setShortcut(QKeySequence(Qt::Key_F8));
|
actionStepOver->setShortcut(QKeySequence(Qt::Key_F8));
|
||||||
actionStepOut = new QAction(stepOutLabel, this);
|
actionStepOut = new QAction(stepOutLabel, this);
|
||||||
actionStepOut->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_F8));
|
actionStepOut->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_F8));
|
||||||
actionStepBack = new QAction(stepBackIcon, stepBackLabel, this);
|
actionStepBack = new QAction(stepBackIcon, stepBackLabel, this);
|
||||||
actionStepBack->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_F7));
|
actionStepBack->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_F7));
|
||||||
actionTrace = new QAction(startTraceIcon, startTraceLabel, this);
|
actionTrace = new QAction(startTraceIcon, startTraceLabel, this);
|
||||||
|
|
||||||
QToolButton *startButton = new QToolButton;
|
QToolButton *startButton = new QToolButton;
|
||||||
|
@ -650,8 +650,7 @@ bool DisassemblyWidget::eventFilter(QObject *obj, QEvent *event)
|
|||||||
&& (obj == mDisasTextEdit || obj == mDisasTextEdit->viewport())) {
|
&& (obj == mDisasTextEdit || obj == mDisasTextEdit->viewport())) {
|
||||||
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
|
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
|
||||||
|
|
||||||
const QTextCursor &cursor =
|
const QTextCursor &cursor = mDisasTextEdit->cursorForPosition(mouseEvent->pos());
|
||||||
mDisasTextEdit->cursorForPosition(QPoint(mouseEvent->x(), mouseEvent->y()));
|
|
||||||
jumpToOffsetUnderCursor(cursor);
|
jumpToOffsetUnderCursor(cursor);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -156,8 +156,7 @@ void GraphView::cleanupEdges(GraphLayout::Graph &graph)
|
|||||||
|
|
||||||
void GraphView::beginMouseDrag(QMouseEvent *event)
|
void GraphView::beginMouseDrag(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
scroll_base_x = event->x();
|
scrollBase = event->pos();
|
||||||
scroll_base_y = event->y();
|
|
||||||
scroll_mode = true;
|
scroll_mode = true;
|
||||||
setCursor(Qt::ClosedHandCursor);
|
setCursor(Qt::ClosedHandCursor);
|
||||||
viewport()->grabMouse();
|
viewport()->grabMouse();
|
||||||
@ -690,10 +689,8 @@ void GraphView::mousePressEvent(QMouseEvent *event)
|
|||||||
void GraphView::mouseMoveEvent(QMouseEvent *event)
|
void GraphView::mouseMoveEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (scroll_mode) {
|
if (scroll_mode) {
|
||||||
addViewOffset(QPoint(scroll_base_x - event->x(), scroll_base_y - event->y())
|
addViewOffset((scrollBase - event->pos()) / current_scale);
|
||||||
/ current_scale);
|
scrollBase = event->pos();
|
||||||
scroll_base_x = event->x();
|
|
||||||
scroll_base_y = event->y();
|
|
||||||
viewport()->update();
|
viewport()->update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -189,9 +189,7 @@ private:
|
|||||||
|
|
||||||
std::unique_ptr<GraphLayout> graphLayoutSystem;
|
std::unique_ptr<GraphLayout> graphLayoutSystem;
|
||||||
|
|
||||||
// Scrolling data
|
QPoint scrollBase;
|
||||||
int scroll_base_x = 0;
|
|
||||||
int scroll_base_y = 0;
|
|
||||||
bool scroll_mode = false;
|
bool scroll_mode = false;
|
||||||
|
|
||||||
bool useGL;
|
bool useGL;
|
||||||
|
@ -116,7 +116,7 @@ HexWidget::HexWidget(QWidget *parent)
|
|||||||
|
|
||||||
actionCopyAddress = new QAction(tr("Copy address"), this);
|
actionCopyAddress = new QAction(tr("Copy address"), this);
|
||||||
actionCopyAddress->setShortcutContext(Qt::ShortcutContext::WidgetWithChildrenShortcut);
|
actionCopyAddress->setShortcutContext(Qt::ShortcutContext::WidgetWithChildrenShortcut);
|
||||||
actionCopyAddress->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_C);
|
actionCopyAddress->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_C);
|
||||||
connect(actionCopyAddress, &QAction::triggered, this, &HexWidget::copyAddress);
|
connect(actionCopyAddress, &QAction::triggered, this, &HexWidget::copyAddress);
|
||||||
addAction(actionCopyAddress);
|
addAction(actionCopyAddress);
|
||||||
|
|
||||||
@ -472,7 +472,7 @@ void HexWidget::mouseMoveEvent(QMouseEvent *event)
|
|||||||
|
|
||||||
QString metaData = getFlagsAndComment(mouseAddr);
|
QString metaData = getFlagsAndComment(mouseAddr);
|
||||||
if (!metaData.isEmpty() && itemArea.contains(pos)) {
|
if (!metaData.isEmpty() && itemArea.contains(pos)) {
|
||||||
QToolTip::showText(event->globalPos(), metaData.replace(",", ", "), this);
|
QToolTip::showText(mapToGlobal(event->pos()), metaData.replace(",", ", "), this);
|
||||||
} else {
|
} else {
|
||||||
QToolTip::hideText();
|
QToolTip::hideText();
|
||||||
}
|
}
|
||||||
|
@ -88,16 +88,13 @@ void OverviewView::paintEvent(QPaintEvent *event)
|
|||||||
void OverviewView::mousePressEvent(QMouseEvent *event)
|
void OverviewView::mousePressEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
mouseActive = true;
|
mouseActive = true;
|
||||||
if (rangeRect.contains(event->pos())) {
|
auto pos = qhelpers::mouseEventPos(event);
|
||||||
initialDiff = QPointF(event->localPos().x() - rangeRect.x(),
|
if (rangeRect.contains(pos)) {
|
||||||
event->localPos().y() - rangeRect.y());
|
initialDiff = pos - rangeRect.topLeft();
|
||||||
} else {
|
} else {
|
||||||
qreal w = rangeRect.width();
|
QPointF size(rangeRect.width(), rangeRect.height());
|
||||||
qreal h = rangeRect.height();
|
initialDiff = size * 0.5;
|
||||||
qreal x = event->localPos().x() - w / 2;
|
rangeRect.moveCenter(pos);
|
||||||
qreal y = event->localPos().y() - h / 2;
|
|
||||||
rangeRect = QRectF(x, y, w, h);
|
|
||||||
initialDiff = QPointF(w / 2, h / 2);
|
|
||||||
viewport()->update();
|
viewport()->update();
|
||||||
emit mouseMoved();
|
emit mouseMoved();
|
||||||
}
|
}
|
||||||
@ -114,9 +111,8 @@ void OverviewView::mouseMoveEvent(QMouseEvent *event)
|
|||||||
if (!mouseActive) {
|
if (!mouseActive) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
qreal x = event->localPos().x() - initialDiff.x();
|
QPointF topLeft = qhelpers::mouseEventPos(event) - initialDiff;
|
||||||
qreal y = event->localPos().y() - initialDiff.y();
|
rangeRect.setTopLeft(topLeft);
|
||||||
rangeRect = QRectF(x, y, rangeRect.width(), rangeRect.height());
|
|
||||||
viewport()->update();
|
viewport()->update();
|
||||||
emit mouseMoved();
|
emit mouseMoved();
|
||||||
}
|
}
|
||||||
|
@ -240,10 +240,11 @@ void VisualNavbar::on_seekChanged(RVA addr)
|
|||||||
|
|
||||||
void VisualNavbar::mousePressEvent(QMouseEvent *event)
|
void VisualNavbar::mousePressEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
qreal x = event->localPos().x();
|
qreal x = qhelpers::mouseEventPos(event).x();
|
||||||
RVA address = localXToAddress(x);
|
RVA address = localXToAddress(x);
|
||||||
if (address != RVA_INVALID) {
|
if (address != RVA_INVALID) {
|
||||||
QToolTip::showText(event->globalPos(), toolTipForAddress(address), this);
|
auto tooltipPos = qhelpers::mouseEventGlobalPos(event);
|
||||||
|
QToolTip::showText(tooltipPos, toolTipForAddress(address), this, this->rect());
|
||||||
if (event->buttons() & Qt::LeftButton) {
|
if (event->buttons() & Qt::LeftButton) {
|
||||||
event->accept();
|
event->accept();
|
||||||
Core()->seek(address);
|
Core()->seek(address);
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
#ifndef WIDGETSHORTCUTS_H
|
#ifndef WIDGETSHORTCUTS_H
|
||||||
#define WIDGETSHORTCUTS_H
|
#define WIDGETSHORTCUTS_H
|
||||||
|
|
||||||
|
#include <QKeySequence>
|
||||||
|
#include <QHash>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
static const QHash<QString, QKeySequence> widgetShortcuts = {
|
static const QHash<QString, QKeySequence> widgetShortcuts = {
|
||||||
{ "StringsWidget", Qt::SHIFT + Qt::Key_F12 }, { "GraphWidget", Qt::SHIFT + Qt::Key_G },
|
{ "StringsWidget", Qt::SHIFT | Qt::Key_F12 }, { "GraphWidget", Qt::SHIFT | Qt::Key_G },
|
||||||
{ "ImportsWidget", Qt::SHIFT + Qt::Key_I }, { "ExportsWidget", Qt::SHIFT + Qt::Key_E },
|
{ "ImportsWidget", Qt::SHIFT | Qt::Key_I }, { "ExportsWidget", Qt::SHIFT | Qt::Key_E },
|
||||||
{ "ConsoleWidget", Qt::CTRL + Qt::Key_QuoteLeft }, { "ConsoleWidgetAlternative", Qt::Key_Colon }
|
{ "ConsoleWidget", Qt::CTRL | Qt::Key_QuoteLeft }, { "ConsoleWidgetAlternative", Qt::Key_Colon }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user