Dax89 / QHexView

A versatile Hexadecimal widget for Qt5

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Horizontal scroll bar issues

audetto opened this issue · comments

I found these 2 issues when using the horizontal scrollbar

  1. the scrollbar moves the content, but does not paint the area which was not originally already visible

  2. if I resize the window when the h scrollbar is not at the leftmost point, the hex area is repainted as if the h scrollbar was on the leftmost point. So, by moving the h scrollbar more to the left, I can display areas on the left of the address, which do not really exist.

I think I have some ideas: vertical scrolling and horizontal scrolling are handled differently.
Vertical is simply telling the renderer which line to start from.
horizontal is done via a viewport->move().

This explains, if the visible area is 100 px, then the renderer paints 100 px from the left, and the view port offsets this.
But the renderer should have displaced horizontally this area and render the visible part.
But this is complicated, maybe it should just extend the visible area to the right.

void QHexView::resizeEvent(QResizeEvent *e)
{
    QAbstractScrollArea::resizeEvent(e);
    this->adjustScrollBars();
    QScrollBar *hscrollbar = this->horizontalScrollBar();
    hscrollbar->setValue(0);
}

This "fixes" problem 2. There is something that resets the position of the viewport to 0. I could not find what.
This will reset the scrollbar to the left.

Some are fixed here
#50

Fixed in #50