Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
4.7.0
-
None
-
28881c0c91aa53412fae32c52ab297c76e890971
Description
It looks as though there is a bug in the way QGraphicsView calculates the viewport rectangle when one of the scrollbars' policy is set to Qt::ScrollBarAlwaysOff.
Test case (attached):
- create a 100 x 400 rectangle item, and set the view's sceneRect to match this rectangle
- set the vertical scrollbar's policy to "always on"
- set the horizontal scrollbar's policy to "always off"
- gently resize the graphics view until the point where the vertical scrollbar becomes active
Expected result:
- the vertical scrollbar allows you to scroll exactly until the end of the rectangle
Actual result:
- the vertical scrollbar allows you to scroll down beyond the end of the rectangle. The additional (unwanted) height is equal to the height which the horizontal bar would have occupied (although it's disabled).
The cause is in QGraphicsViewPrivate::recalculateContentSize at line 397 in qgraphicsview.cpp, useHorizontalScrollBar can get set to "true" even though the policy is "always off". The same problem is true concerning the vertical scrollbar policy. I will submit a merge request for a suggested fix.
Attachments
Issue Links
- is duplicated by
-
QTBUG-1784 QGraphicsViewPrivate::recalculateContentSize() Bug
- Closed