You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
2.1 KiB
52 lines
2.1 KiB
From 9c27fd5c02dd4314192d142a9f2120be45748414 Mon Sep 17 00:00:00 2001
|
|
From: Fushan Wen <qydwhotmail@gmail.com>
|
|
Date: Fri, 21 Apr 2023 23:38:04 +0800
|
|
Subject: [PATCH 20/25] Revert "QQuickItem: Fix effective visibility for items
|
|
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 7236973216..708dc5fe5e 100644
|
|
--- a/src/quick/items/qquickitem.cpp
|
|
+++ b/src/quick/items/qquickitem.cpp
|
|
@@ -6082,8 +6082,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);
|
|
--
|
|
2.46.0
|
|
|