Fix for Qt hex editor viewport getting out of sync with vertical scroll bar. Force line offset to come directly from scroll bar value during paint event. Issue #450

This commit is contained in:
mjbudd77 2022-01-21 23:10:17 -05:00
parent 41df815cf6
commit 91e530aa99
1 changed files with 7 additions and 0 deletions

View File

@ -1564,23 +1564,27 @@ void HexEditorDialog_t::vbarMoved(int value)
{ {
//printf("VBar Moved: %i\n", value); //printf("VBar Moved: %i\n", value);
editor->setLine( value ); editor->setLine( value );
editor->update();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void HexEditorDialog_t::vbarChanged(int value) void HexEditorDialog_t::vbarChanged(int value)
{ {
//printf("VBar Changed: %i\n", value); //printf("VBar Changed: %i\n", value);
editor->setLine( value ); editor->setLine( value );
editor->update();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void HexEditorDialog_t::hbarChanged(int value) void HexEditorDialog_t::hbarChanged(int value)
{ {
//printf("HBar Changed: %i\n", value); //printf("HBar Changed: %i\n", value);
editor->setHorzScroll( value ); editor->setHorzScroll( value );
editor->update();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void HexEditorDialog_t::gotoAddress( int newAddr ) void HexEditorDialog_t::gotoAddress( int newAddr )
{ {
editor->setAddr( newAddr ); editor->setAddr( newAddr );
editor->update();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void HexEditorDialog_t::saveRomFile(void) void HexEditorDialog_t::saveRomFile(void)
@ -3731,6 +3735,9 @@ void QHexEdit::paintEvent(QPaintEvent *event)
{ {
maxLineOffset = 0; maxLineOffset = 0;
} }
vbar->setMaximum( maxLineOffset );
lineOffset = vbar->value();
if ( lineOffset < 0 ) if ( lineOffset < 0 )
{ {