qt5-qtdeclarative/0022-Revert-QQuickItem-Fix-effective-visibility-for-items.patch

52 lines
2.1 KiB
Diff
Raw Normal View History

2023-10-08 12:44:24 +00:00
From 75d7d0370a3a19615e9aab6a23519eb529e4de87 Mon Sep 17 00:00:00 2001
2023-06-13 07:00:39 +00:00
From: Fushan Wen <qydwhotmail@gmail.com>
Date: Fri, 21 Apr 2023 23:38:04 +0800
2023-10-08 12:44:24 +00:00
Subject: [PATCH 22/30] Revert "QQuickItem: Fix effective visibility for items
2023-06-13 07:00:39 +00:00
without parent"
This breaks applications that use QQmlPropertyList to store QQuickItem
and don't set a parentItem for them.
Ref: https://github.com/musescore/MuseScore/issues/17276
This reverts commit 45c22a0221937682f4496801a495458a00f76d3a.
---
src/quick/items/qquickitem.cpp | 6 ++++--
tests/auto/quick/qquickitem/tst_qquickitem.cpp | 2 --
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index 0d421349d7..c370d6e5c3 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -6081,8 +6081,10 @@ void QQuickItem::setEnabled(bool e)
bool QQuickItemPrivate::calcEffectiveVisible() const
{
- // An item is visible if it is a child of a visible parent, and not explicitly hidden.
- return explicitVisible && parentItem && QQuickItemPrivate::get(parentItem)->effectiveVisible;
+ // XXX todo - Should the effective visible of an element with no parent just be the current
+ // effective visible? This would prevent pointless re-processing in the case of an element
+ // moving to/from a no-parent situation, but it is different from what graphics view does.
+ return explicitVisible && (!parentItem || QQuickItemPrivate::get(parentItem)->effectiveVisible);
}
bool QQuickItemPrivate::setEffectiveVisibleRecur(bool newEffectiveVisible)
diff --git a/tests/auto/quick/qquickitem/tst_qquickitem.cpp b/tests/auto/quick/qquickitem/tst_qquickitem.cpp
index 34eefd85e6..42348d8dd1 100644
--- a/tests/auto/quick/qquickitem/tst_qquickitem.cpp
+++ b/tests/auto/quick/qquickitem/tst_qquickitem.cpp
@@ -989,9 +989,7 @@ void tst_qquickitem::setParentItem()
void tst_qquickitem::visible()
{
- QQuickWindow window;
QQuickItem *root = new QQuickItem;
- root->setParentItem(window.contentItem());
QQuickItem *child1 = new QQuickItem;
child1->setParentItem(root);
--
2023-10-08 12:44:24 +00:00
2.41.0
2023-06-13 07:00:39 +00:00