diff options
author | Qiang Li <liqianga@uniontech.com> | 2021-02-24 20:49:07 +0800 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-03-30 15:10:38 +0000 |
commit | 3dca0aaf09c7859b30adbe9e95da6840a6906d4f (patch) | |
tree | 24d4dc92270f8e43f2648223b2bbf575216fa6fb /src | |
parent | 1b1f2b265ebb25df8416293c6692fe82ab08e465 (diff) |
Fix z-value of QGraphicsItems being ignored during draw
In QGraphicsScene's function draw, don't copy the children into a
const copy (to prevent detaching in the loops), as they might get
sorted. Instead, use a const reference.
Amends e349f787d595aa343ca86af94159b6730d55b8d5, which introduced
the bug by making a copy of the unsorted list.
Fixes: QTBUG-81316
Change-Id: Iab9b87e75178a883806088a9db234c7a2aaa9301
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 269fdef53d98386b714bf6852a1f214e9159faa1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/graphicsview/qgraphicsscene.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp index 2e65effb1a..dd54a4bffa 100644 --- a/src/widgets/graphicsview/qgraphicsscene.cpp +++ b/src/widgets/graphicsview/qgraphicsscene.cpp @@ -4821,7 +4821,7 @@ void QGraphicsScenePrivate::draw(QGraphicsItem *item, QPainter *painter, const Q qreal opacity, const QTransform *effectTransform, bool wasDirtyParentSceneTransform, bool drawItem) { - const auto children = item->d_ptr->children; + const auto &children = item->d_ptr->children; const bool itemIsFullyTransparent = QGraphicsItemPrivate::isOpacityNull(opacity); const bool itemClipsChildrenToShape = (item->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape); |