It can easily be demonstrated using the following code:
...
myscene->addText("My very very long text line 1");
myscene
->addText
("My very very long text line 2")->setPos
(QPointF(0,
25));
myview->show();
...
...
QGraphicsScene* myscene = new QGraphicsScene();
myscene->addText("My very very long text line 1");
myscene->addText("My very very long text line 2")->setPos(QPointF(0,25));
QGraphicsView* myview = new QGraphicsView(myscene);
myview->show();
...
To copy to clipboard, switch view to plain text mode
Now reduce the window width until the horizontal scrollbar. The entire text is reachable through the scrollbar.
Now reduce the window height until also the vertical scrollbar appears.
Two things can be noticed now:
- The vertical scrollbar appears too late (as if the horizontal scrollbar was not visible).
- The horizontal scrollbar is not adapted to make the content covered by the vertical scrollbar reachable (you can no longer scroll to the "2").
In short: using Qt::ScrollBarAsNeeded, a scrollbar does not take into account the area covered by the other scrollbar when it is visible.
Using Qt::ScrollBarAlwaysOn, the behavior is correct.
[This behavior shows in Qt 4.2.0 and 4.2.1.]
Bookmarks