[plasma/union/Plasma/6.7] src/output/qtquick/plugin: output/quick: Complete incompleted ancestors on QuickElement completion

Arjen Hiemstra <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit f7e3ad979f011b61da76655af60f01b3fb8a38f7 by Arjen Hiemstra.
Committed on 16/07/2026 at 18:52.
Pushed by ahiemstra into branch 'Plasma/6.7'.

output/quick: Complete incompleted ancestors on QuickElement completion

Some ancestors of a QuickElement may end up never getting
`componentCompleted()` called. This would result in them being in an
incomplete state which breaks things. Fix this by manually checking if
all ancestors that are not attached to a QQuickItem are completed, and
if not, complete them.

Ultimately we probably need a different trigger than componentComplete()
to handle these cases, but right now this suffices.


(cherry picked from commit 1d4e624af84fb95e4dc0eb1cd8db3f2c31f773bc)

Co-authored-by: Arjen Hiemstra <[email protected]>

M  +14   -0    src/output/qtquick/plugin/QuickElement.cpp

https://invent.kde.org/plasma/union/-/commit/f7e3ad979f011b61da76655af60f01b3fb8a38f7

diff --git a/src/output/qtquick/plugin/QuickElement.cpp b/src/output/qtquick/plugin/QuickElement.cpp
index 3edf382e..53f647ed 100644
--- a/src/output/qtquick/plugin/QuickElement.cpp
+++ b/src/output/qtquick/plugin/QuickElement.cpp
@@ -436,6 +436,20 @@ void QuickElement::componentComplete()
     updateHints();
     updateAttributes();
     update();
+
+    // It is possible that `QQuickAttachedPropertyPropagator::initialize()`
+    // creates QuickElement instances that are not attached to a QQuickItem for
+    // which `componentComplete()` does not get called. So go through our
+    // ancestors once and ensure `componentComplete()` is called at least once
+    // for these elements, otherwise they are in a defunct state and do not work
+    // properly.
+    auto element = parentElement();
+    while (element) {
+        if (!element->m_completed && !qobject_cast<QQuickItem *>(element->parent())) {
+            element->componentComplete();
+        }
+        element = element->parentElement();
+    }
 }
 
 void QuickElement::setActiveStates(Union::Element::States newActiveStates)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.