forked from quickshell/quickshell
core/window: fix attached property prior to backer creation
This commit is contained in:
parent
e48af44607
commit
6367b56f55
2 changed files with 11 additions and 7 deletions
|
@ -26,6 +26,7 @@ ProxyWindowBase::ProxyWindowBase(QObject* parent)
|
||||||
, mContentItem(new QQuickItem()) {
|
, mContentItem(new QQuickItem()) {
|
||||||
QQmlEngine::setObjectOwnership(this->mContentItem, QQmlEngine::CppOwnership);
|
QQmlEngine::setObjectOwnership(this->mContentItem, QQmlEngine::CppOwnership);
|
||||||
this->mContentItem->setParent(this);
|
this->mContentItem->setParent(this);
|
||||||
|
this->mContentItem->setProperty("__qs_proxywindow", QVariant::fromValue(this));
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
QObject::connect(this, &ProxyWindowBase::widthChanged, this, &ProxyWindowBase::onWidthChanged);
|
QObject::connect(this, &ProxyWindowBase::widthChanged, this, &ProxyWindowBase::onWidthChanged);
|
||||||
|
@ -124,8 +125,6 @@ void ProxyWindowBase::connectWindow() {
|
||||||
generation->registerIncubationController(this->window->incubationController());
|
generation->registerIncubationController(this->window->incubationController());
|
||||||
}
|
}
|
||||||
|
|
||||||
this->window->setProperty("__qs_proxywindow", QVariant::fromValue(this));
|
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
QObject::connect(this->window, &QWindow::visibilityChanged, this, &ProxyWindowBase::visibleChanged);
|
QObject::connect(this->window, &QWindow::visibilityChanged, this, &ProxyWindowBase::visibleChanged);
|
||||||
QObject::connect(this->window, &QWindow::xChanged, this, &ProxyWindowBase::xChanged);
|
QObject::connect(this->window, &QWindow::xChanged, this, &ProxyWindowBase::xChanged);
|
||||||
|
|
|
@ -7,11 +7,16 @@
|
||||||
#include "proxywindow.hpp"
|
#include "proxywindow.hpp"
|
||||||
|
|
||||||
QsWindowAttached* WindowInterface::qmlAttachedProperties(QObject* object) {
|
QsWindowAttached* WindowInterface::qmlAttachedProperties(QObject* object) {
|
||||||
auto* item = qobject_cast<QQuickItem*>(object);
|
auto* visualRoot = qobject_cast<QQuickItem*>(object);
|
||||||
if (!item) return nullptr;
|
|
||||||
auto* window = item->window();
|
ProxyWindowBase* proxy = nullptr;
|
||||||
if (!window) return nullptr;
|
while (visualRoot != nullptr) {
|
||||||
auto* proxy = window->property("__qs_proxywindow").value<ProxyWindowBase*>();
|
proxy = visualRoot->property("__qs_proxywindow").value<ProxyWindowBase*>();
|
||||||
|
|
||||||
|
if (proxy) break;
|
||||||
|
visualRoot = visualRoot->parentItem();
|
||||||
|
};
|
||||||
|
|
||||||
if (!proxy) return nullptr;
|
if (!proxy) return nullptr;
|
||||||
|
|
||||||
auto v = proxy->property("__qs_window_attached");
|
auto v = proxy->property("__qs_window_attached");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue