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;
mDrawDebugOnly = false;
mPopupEnabled = true;
mPopupTimer = 0;
// ScrollBar Init
setVerticalScrollBar(new AbstractTableScrollBar(verticalScrollBar()));
@ -1292,6 +1293,8 @@ void AbstractTableView::ShowDisassemblyPopup(duint addr, int x, int y)
{
if(!mPopupEnabled || !addr)
{
killTimer(mPopupTimer);
mPopupTimer = 0;
if(mDisassemblyPopup)
mDisassemblyPopup->hide();
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->setAddress(addr);
mDisassemblyPopup->show();
//mDisassemblyPopup->show();
mPopupTimer = startTimer(QApplication::startDragTime());
}
else
{
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)

View File

@ -146,6 +146,7 @@ public 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 timerEvent(QTimerEvent* event);
private slots:
// Configuration
@ -211,6 +212,7 @@ private:
bool mDrawDebugOnly;
bool mPopupEnabled;
bool mAllowPainting;
int mPopupTimer;
static int mMouseWheelScrollDelta;
ScrollBar64 mScrollBarAttributes;