Added hex editor X,Y cursor movement via arrow keys.

This commit is contained in:
Matthew Budd 2020-08-20 22:34:45 -04:00
parent 5f57455de7
commit f6afca360f
1 changed files with 21 additions and 1 deletions

View File

@ -432,6 +432,26 @@ void QHexEdit::keyPressEvent(QKeyEvent *event)
{ {
printf("Hex Window Key Press: 0x%x \n", event->key() ); printf("Hex Window Key Press: 0x%x \n", event->key() );
if (event->matches(QKeySequence::MoveToNextChar))
{
cursorPosX++;
if ( cursorPosX >= 48 )
{
cursorPosX = 47;
}
resetCursorBlink();
}
if (event->matches(QKeySequence::MoveToPreviousChar))
{
cursorPosX--;
if ( cursorPosX < 0 )
{
cursorPosX = 0;
}
resetCursorBlink();
}
if (event->matches(QKeySequence::MoveToPreviousLine)) if (event->matches(QKeySequence::MoveToPreviousLine))
{ {
cursorPosY--; cursorPosY--;
@ -534,7 +554,7 @@ void QHexEdit::paintEvent(QPaintEvent *event)
} }
else else
{ {
x = pxHexAscii; x = pxHexAscii + (cursorPosX - 32)*pxCharWidth;
} }
//painter.setPen( this->palette().color(QPalette::WindowText)); //painter.setPen( this->palette().color(QPalette::WindowText));