qt6-bb10/tests/auto/widgets/graphicsview
Volker Hilsheimer 2e12479e06 QGraphicsScene: respect that items can override selection changes
QGraphicsItems may override itemChange to prevent certain attribute
changes. Overriding ItemSelectedChange this way is explicitly documented
to be allowed.

However QGraphicsScene::clearSelection did not test whether items were
in fact deselected after the call to setSelection, and always cleared
the stored set of selected items.

Fix this by checking the actual selected state of the item as we iterate
over them, and store those items that are still selected in a set that
becomes the new selectedItems set (which will be empty if no item
overrides, which is the default).

Add a test that also checks that clearing the selection emits the
selectionChanged signal correctly (and does not if all selected items
block being deselected).

Fixes: QTBUG-85474
Pick-to: 6.4 6.3 6.2
Change-Id: I665afc132876e02e6e1061b7be37f4f6e4be418f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-06-20 20:44:23 +02:00
..
qgraphicsanchorlayout Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qgraphicsanchorlayout1 Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qgraphicseffectsource Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qgraphicsgridlayout Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qgraphicsitem Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qgraphicsitemanimation Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qgraphicslayout Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qgraphicslayoutitem Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qgraphicslinearlayout Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qgraphicsobject Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qgraphicspixmapitem Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qgraphicspolygonitem Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qgraphicsproxywidget Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qgraphicsscene QGraphicsScene: respect that items can override selection changes 2022-06-20 20:44:23 +02:00
qgraphicssceneindex Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qgraphicstransform Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qgraphicsview unblacklist passing tests 2022 2022-05-18 23:59:19 +02:00
qgraphicswidget Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
CMakeLists.txt Activate tst_qgraphicsview for Android 2022-02-24 14:34:32 +01:00