Changed cursor movement logic to move to nearest hex address.
This commit is contained in:
parent
b01b1c7a4c
commit
66810fdb9d
|
@ -890,9 +890,22 @@ 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))
|
if (event->matches(QKeySequence::MoveToNextChar))
|
||||||
|
{
|
||||||
|
if ( cursorPosX < 32 )
|
||||||
|
{
|
||||||
|
if ( cursorPosX % 2 )
|
||||||
{
|
{
|
||||||
cursorPosX++;
|
cursorPosX++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cursorPosX += 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cursorPosX++;
|
||||||
|
}
|
||||||
if ( cursorPosX >= 48 )
|
if ( cursorPosX >= 48 )
|
||||||
{
|
{
|
||||||
cursorPosX = 47;
|
cursorPosX = 47;
|
||||||
|
@ -900,9 +913,22 @@ void QHexEdit::keyPressEvent(QKeyEvent *event)
|
||||||
resetCursor();
|
resetCursor();
|
||||||
}
|
}
|
||||||
else if (event->matches(QKeySequence::MoveToPreviousChar))
|
else if (event->matches(QKeySequence::MoveToPreviousChar))
|
||||||
|
{
|
||||||
|
if ( cursorPosX < 33 )
|
||||||
|
{
|
||||||
|
if ( cursorPosX % 2 )
|
||||||
|
{
|
||||||
|
cursorPosX -= 3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cursorPosX -= 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
cursorPosX--;
|
cursorPosX--;
|
||||||
|
}
|
||||||
if ( cursorPosX < 0 )
|
if ( cursorPosX < 0 )
|
||||||
{
|
{
|
||||||
cursorPosX = 0;
|
cursorPosX = 0;
|
||||||
|
|
Loading…
Reference in New Issue