diff options
author | Bjørn Erik Nilsen <bjorn.nilsen@nokia.com> | 2010-05-11 17:06:12 (GMT) |
---|---|---|
committer | Bjørn Erik Nilsen <bjorn.nilsen@nokia.com> | 2010-05-21 13:19:04 (GMT) |
commit | 1a0c51ffed4f7d86620b00adc3e22d044deef0c0 (patch) | |
tree | c0421de53e7eb766c7ba11e48fc5b3301eb44b38 /doc | |
parent | abc0bd321356907dafc4a5cbca57a335a9f6ae3e (diff) | |
download | Qt-1a0c51ffed4f7d86620b00adc3e22d044deef0c0.zip Qt-1a0c51ffed4f7d86620b00adc3e22d044deef0c0.tar.gz Qt-1a0c51ffed4f7d86620b00adc3e22d044deef0c0.tar.bz2 |
Fixes QGraphicsItem::scroll issues
The biggest and most important issue was that QGraphicsItem::scroll
always accelerated the scroll without taking overlapping items or
opacity into account, which caused drawing artifacts. We can only do
accelerated scrolling if the item is opaque and not overlapped by
other items. There's no (sane) way to detect whether an item is
opaque or not (similar to Qt::WA_OpaquePaintEvent), which means we
cannot support accelerated scrolling unless the item is cached into
a pixmap (QGraphicsItem::setCacheMode).
The second issue was that QStyleOptionGraphicsItem::exposedRect always
contained the whole boundinRect() after an accelerated scroll
(even with the QGraphicsItem::ItemUsesExtendedStyleOption flag enabled).
Auto test included.
Task-number: QTBUG-8378, QTBUG-7703
Reviewed-by: yoann
Diffstat (limited to 'doc')
-rw-r--r-- | doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp b/doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp index 4f27661..81099a7 100644 --- a/doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp +++ b/doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp @@ -271,3 +271,9 @@ class QGraphicsPathItem : public QAbstractGraphicsShapeItem }; //! [18] +//! [19] +QTransform xform = item->deviceTransform(view->viewportTransform()); +QRect deviceRect = xform.mapRect(rect).toAlignedRect(); +view->viewport()->scroll(dx, dy, deviceRect); +//! [19] + |