Details
-
Bug
-
Resolution: Out of scope
-
P4: Low
-
4.7.0
-
None
Description
It took a long time to figure out how to compensate for how Qt aligns the scene rectangle within the view in QGraphicsViewPrivate::recalculateContentSize, and updates the scrollX and scrollY offset values in QGraphicsViewPrivate:updateScroll. We ended up finding a way to do this by re-implementing the virtual method scrollContentsBy, in order to counteract how Qt tried to impose an alignment. This was the only way we were able to implement our custom pan and zoom. We wanted to have:
(1) No scroll bars
(2) Arbitrary panning (even with the scene rectangle zoomed out)
(3) Zoom to always scale about the centre of the view (and not necessarily the center of the scene rectangle)
Custom scrolling would be much easier to do if QGraphicsView had an additional alignment option which was, say, Qt::AlignNone. In QGraphicsViewPrivate::updateScroll, if Qt::AlignNone was in effect, scrollX and scrollY would never be recomputed (and would be initialized to say, 0), and therefore, there would be no need to compute leftIndent and topIndent in QGraphicsViewPrivate::recalculateContentSize.