diff --git a/src/cpp/proxywindow.cpp b/src/cpp/proxywindow.cpp index b86c0ad5..a7bf939b 100644 --- a/src/cpp/proxywindow.cpp +++ b/src/cpp/proxywindow.cpp @@ -32,6 +32,8 @@ QQuickWindow* ProxyWindowBase::disownWindow() { return window; } +QQuickItem* ProxyWindowBase::item() { return this->window->contentItem(); } + // NOLINTNEXTLINE #define PROXYPROP(type, get, set) \ type ProxyWindowBase::get() { return this->window->get(); } \ diff --git a/src/cpp/proxywindow.hpp b/src/cpp/proxywindow.hpp index ee7f35fa..35240f59 100644 --- a/src/cpp/proxywindow.hpp +++ b/src/cpp/proxywindow.hpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -15,9 +16,10 @@ // Detaching a window and touching any property is a use after free. // // NOTE: setting an `id` in qml will point to the proxy window and not the real window so things -// like anchors dont work +// like anchors must use `item`. class ProxyWindowBase: public Scavenger { Q_OBJECT; + Q_PROPERTY(QQuickItem* item READ item CONSTANT); Q_PROPERTY(bool visible READ isVisible WRITE setVisible); Q_PROPERTY(qint32 width READ width WRITE setWidth); Q_PROPERTY(qint32 height READ height WRITE setHeight); @@ -40,6 +42,8 @@ public: // Disown the backing window and delete all its children. QQuickWindow* disownWindow(); + QQuickItem* item(); + bool isVisible(); virtual void setVisible(bool value);