Added mouse wheel scrolling capability for Qt debugger ASM viewer.
This commit is contained in:
parent
bfa70c1f25
commit
43f87541b6
|
@ -2837,6 +2837,8 @@ QAsmView::QAsmView(QWidget *parent)
|
|||
selAddrValue = -1;
|
||||
memset( selAddrText, 0, sizeof(selAddrText) );
|
||||
|
||||
wheelPixelCounter = 0;
|
||||
|
||||
//setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Expanding );
|
||||
setFocusPolicy(Qt::StrongFocus);
|
||||
|
||||
|
@ -3251,6 +3253,8 @@ void QAsmView::mousePressEvent(QMouseEvent * event)
|
|||
|
||||
line = lineOffset + c.y();
|
||||
|
||||
//printf("Mouse Button Pressed: 0x%x (%i,%i)\n", event->button(), c.x(), c.y() );
|
||||
|
||||
if ( event->button() == Qt::LeftButton )
|
||||
{
|
||||
//printf("Left Button Pressed: (%i,%i)\n", c.x(), c.y() );
|
||||
|
@ -3399,6 +3403,54 @@ void QAsmView::mousePressEvent(QMouseEvent * event)
|
|||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
void QAsmView::wheelEvent(QWheelEvent *event)
|
||||
{
|
||||
|
||||
QPoint numPixels = event->pixelDelta();
|
||||
QPoint numDegrees = event->angleDelta() / 8;
|
||||
|
||||
if (!numPixels.isNull())
|
||||
{
|
||||
wheelPixelCounter += numPixels.y();
|
||||
//printf("numPixels: (%i,%i) \n", numPixels.x(), numPixels.y() );
|
||||
}
|
||||
else if (!numDegrees.isNull())
|
||||
{
|
||||
//QPoint numSteps = numDegrees / 15;
|
||||
//printf("numSteps: (%i,%i) \n", numSteps.x(), numSteps.y() );
|
||||
//printf("numDegrees: (%i,%i) %i\n", numDegrees.x(), numDegrees.y(), pxLineSpacing );
|
||||
wheelPixelCounter += (pxLineSpacing * numDegrees.y()) / 15;
|
||||
}
|
||||
//printf("Wheel Event: %i\n", wheelPixelCounter);
|
||||
|
||||
if ( wheelPixelCounter >= pxLineSpacing )
|
||||
{
|
||||
lineOffset += (wheelPixelCounter / pxLineSpacing);
|
||||
|
||||
if ( lineOffset > maxLineOffset )
|
||||
{
|
||||
lineOffset = maxLineOffset;
|
||||
}
|
||||
vbar->setValue( lineOffset );
|
||||
|
||||
wheelPixelCounter = wheelPixelCounter % pxLineSpacing;
|
||||
}
|
||||
else if ( wheelPixelCounter <= -pxLineSpacing )
|
||||
{
|
||||
lineOffset += (wheelPixelCounter / pxLineSpacing);
|
||||
|
||||
if ( lineOffset < 0 )
|
||||
{
|
||||
lineOffset = 0;
|
||||
}
|
||||
vbar->setValue( lineOffset );
|
||||
|
||||
wheelPixelCounter = wheelPixelCounter % pxLineSpacing;
|
||||
}
|
||||
|
||||
event->accept();
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
void QAsmView::contextMenuEvent(QContextMenuEvent *event)
|
||||
{
|
||||
int line;
|
||||
|
|
|
@ -120,6 +120,7 @@ class QAsmView : public QWidget
|
|||
void mouseReleaseEvent(QMouseEvent * event);
|
||||
void mouseMoveEvent(QMouseEvent * event);
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
void wheelEvent(QWheelEvent *event);
|
||||
void contextMenuEvent(QContextMenuEvent *event);
|
||||
void loadHighlightToClipboard(void);
|
||||
|
||||
|
@ -167,6 +168,8 @@ class QAsmView : public QWidget
|
|||
int txtHlgtEndChar;
|
||||
int txtHlgtEndLine;
|
||||
|
||||
int wheelPixelCounter;
|
||||
|
||||
dbg_asm_entry_t *asmPC;
|
||||
std::vector <dbg_asm_entry_t*> asmEntry;
|
||||
|
||||
|
|
Loading…
Reference in New Issue