fix: make ProxyWindowBase's contentItem accessible for anchors

This commit is contained in:
outfoxxed committed 2024-02-01 02:40:05 -08:00
1 parent 362789fc46
commit e1281b8e7b
2 files changed
+7 -1

No files matched your search

+2
View File
@@ -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(); } \
+5 -1
View File
@@ -4,6 +4,7 @@
#include <qobject.h>
#include <qqmllist.h>
#include <qqmlparserstatus.h>
#include <qquickitem.h>
#include <qquickwindow.h>
#include <qtmetamacros.h>
#include <qtypes.h>
@@ -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);