core/window: add QsWindow attached object to contained Items

This commit is contained in:
outfoxxed 2024-07-17 20:54:29 -07:00
parent d1c33d48cd
commit e48af44607
Signed by untrusted user: outfoxxed
GPG key ID: 4C88A185FB89301E
4 changed files with 75 additions and 1 deletions

View file

@ -11,6 +11,7 @@
#include <qregion.h>
#include <qtmetamacros.h>
#include <qtypes.h>
#include <qvariant.h>
#include <qwindow.h>
#include "generation.hpp"
@ -123,6 +124,8 @@ void ProxyWindowBase::connectWindow() {
generation->registerIncubationController(this->window->incubationController());
}
this->window->setProperty("__qs_proxywindow", QVariant::fromValue(this));
// clang-format off
QObject::connect(this->window, &QWindow::visibilityChanged, this, &ProxyWindowBase::visibleChanged);
QObject::connect(this->window, &QWindow::xChanged, this, &ProxyWindowBase::xChanged);
@ -344,3 +347,6 @@ QQmlListProperty<QObject> ProxyWindowBase::data() {
void ProxyWindowBase::onWidthChanged() { this->mContentItem->setWidth(this->width()); }
void ProxyWindowBase::onHeightChanged() { this->mContentItem->setHeight(this->height()); }
QObject* ProxyWindowAttached::window() const { return this->mWindow; }
QQuickItem* ProxyWindowAttached::contentItem() const { return this->mWindow->contentItem(); }