feat: expose the backing window for ProxyWindowBase

This commit is contained in:
outfoxxed 2024-02-13 00:58:47 -08:00
parent ad2450762b
commit 5f75c40b67
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
2 changed files with 10 additions and 0 deletions

View file

@ -42,6 +42,7 @@ QQuickWindow* ProxyWindowBase::disownWindow() {
return window; return window;
} }
QQuickWindow* ProxyWindowBase::backingWindow() { return this->window; }
QQuickItem* ProxyWindowBase::item() { return this->window->contentItem(); } QQuickItem* ProxyWindowBase::item() { return this->window->contentItem(); }
// NOLINTNEXTLINE // NOLINTNEXTLINE

View file

@ -20,6 +20,14 @@
// like anchors must use `item`. // like anchors must use `item`.
class ProxyWindowBase: public Scavenger { class ProxyWindowBase: public Scavenger {
Q_OBJECT; Q_OBJECT;
/// The QtQuick window backing this window.
///
/// > [!WARNING] Do not expect values set via this property to work correctly.
/// > Values set this way will almost certainly misbehave across a reload, possibly
/// > even without one.
/// >
/// > Use **only** if you know what you are doing.
Q_PROPERTY(QQuickWindow* _backingWindow READ backingWindow);
/// The content item of the window. /// The content item of the window.
Q_PROPERTY(QQuickItem* item READ item CONSTANT); Q_PROPERTY(QQuickItem* item READ item CONSTANT);
/// The visibility of the window. /// The visibility of the window.
@ -63,6 +71,7 @@ public:
// Disown the backing window and delete all its children. // Disown the backing window and delete all its children.
virtual QQuickWindow* disownWindow(); virtual QQuickWindow* disownWindow();
QQuickWindow* backingWindow();
QQuickItem* item(); QQuickItem* item();
virtual bool isVisible(); virtual bool isVisible();