1
0
Fork 0

Set a small delay for appearance of disassembly popup

This commit is contained in:
torusrxxx 2020-08-03 23:50:49 +08:00 committed by Duncan Ogilvie
parent c2c0f75434
commit c0684f923d
2 changed files with 22 additions and 1 deletions

View File

@ -58,6 +58,7 @@ AbstractTableView::AbstractTableView(QWidget* parent)
mAllowPainting = true; mAllowPainting = true;
mDrawDebugOnly = false; mDrawDebugOnly = false;
mPopupEnabled = true; mPopupEnabled = true;
mPopupTimer = 0;
// ScrollBar Init // ScrollBar Init
setVerticalScrollBar(new AbstractTableScrollBar(verticalScrollBar())); setVerticalScrollBar(new AbstractTableScrollBar(verticalScrollBar()));
@ -1292,6 +1293,8 @@ void AbstractTableView::ShowDisassemblyPopup(duint addr, int x, int y)
{ {
if(!mPopupEnabled || !addr) if(!mPopupEnabled || !addr)
{ {
killTimer(mPopupTimer);
mPopupTimer = 0;
if(mDisassemblyPopup) if(mDisassemblyPopup)
mDisassemblyPopup->hide(); mDisassemblyPopup->hide();
return; return;
@ -1304,10 +1307,26 @@ void AbstractTableView::ShowDisassemblyPopup(duint addr, int x, int y)
{ {
mDisassemblyPopup->move(mapToGlobal(QPoint(x + 20, y + fontMetrics().height() * 2))); mDisassemblyPopup->move(mapToGlobal(QPoint(x + 20, y + fontMetrics().height() * 2)));
mDisassemblyPopup->setAddress(addr); mDisassemblyPopup->setAddress(addr);
mDisassemblyPopup->show(); //mDisassemblyPopup->show();
mPopupTimer = startTimer(QApplication::startDragTime());
} }
else else
{
mDisassemblyPopup->hide(); mDisassemblyPopup->hide();
killTimer(mPopupTimer);
mPopupTimer = 0;
}
}
void AbstractTableView::timerEvent(QTimerEvent* event)
{
if(event->timerId() == mPopupTimer)
{
mDisassemblyPopup->show();
killTimer(mPopupTimer);
mPopupTimer = 0;
}
QAbstractScrollArea::timerEvent(event);
} }
void AbstractTableView::hideEvent(QHideEvent* event) void AbstractTableView::hideEvent(QHideEvent* event)

View File

@ -146,6 +146,7 @@ public slots:
protected slots: protected slots:
void ShowDisassemblyPopup(duint addr, int x, int y); // this should probably be a slot, but doesn't need emit fixes (it's already used correctly) void ShowDisassemblyPopup(duint addr, int x, int y); // this should probably be a slot, but doesn't need emit fixes (it's already used correctly)
void timerEvent(QTimerEvent* event);
private slots: private slots:
// Configuration // Configuration
@ -211,6 +212,7 @@ private:
bool mDrawDebugOnly; bool mDrawDebugOnly;
bool mPopupEnabled; bool mPopupEnabled;
bool mAllowPainting; bool mAllowPainting;
int mPopupTimer;
static int mMouseWheelScrollDelta; static int mMouseWheelScrollDelta;
ScrollBar64 mScrollBarAttributes; ScrollBar64 mScrollBarAttributes;