core/window: fix attached property prior to backer creation

This commit is contained in:
outfoxxed 2024-07-18 01:57:40 -07:00
parent e48af44607
commit 6367b56f55
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
2 changed files with 11 additions and 7 deletions

View file

@ -7,11 +7,16 @@
#include "proxywindow.hpp"
QsWindowAttached* WindowInterface::qmlAttachedProperties(QObject* object) {
auto* item = qobject_cast<QQuickItem*>(object);
if (!item) return nullptr;
auto* window = item->window();
if (!window) return nullptr;
auto* proxy = window->property("__qs_proxywindow").value<ProxyWindowBase*>();
auto* visualRoot = qobject_cast<QQuickItem*>(object);
ProxyWindowBase* proxy = nullptr;
while (visualRoot != nullptr) {
proxy = visualRoot->property("__qs_proxywindow").value<ProxyWindowBase*>();
if (proxy) break;
visualRoot = visualRoot->parentItem();
};
if (!proxy) return nullptr;
auto v = proxy->property("__qs_window_attached");