11#include " proxywindow.hpp"
22
33#include < private/qquickwindow_p.h>
4+ #include < qevent.h>
45#include < qnamespace.h>
56#include < qobject.h>
67#include < qqmlcontext.h>
@@ -80,7 +81,7 @@ void ProxyWindowBase::onReload(QObject* oldInstance) {
8081
8182void ProxyWindowBase::postCompleteWindow () { this ->setVisible (this ->mVisible ); }
8283
83- QQuickWindow * ProxyWindowBase::createQQuickWindow () { return new QQuickWindow (); }
84+ ProxiedWindow * ProxyWindowBase::createQQuickWindow () { return new ProxiedWindow (); }
8485
8586void ProxyWindowBase::createWindow () {
8687 if (this ->window != nullptr ) return ;
@@ -102,7 +103,7 @@ void ProxyWindowBase::deleteWindow(bool keepItemOwnership) {
102103 }
103104}
104105
105- QQuickWindow * ProxyWindowBase::disownWindow (bool keepItemOwnership) {
106+ ProxiedWindow * ProxyWindowBase::disownWindow (bool keepItemOwnership) {
106107 if (this ->window == nullptr ) return nullptr ;
107108
108109 QObject::disconnect (this ->window , nullptr , this , nullptr );
@@ -116,7 +117,7 @@ QQuickWindow* ProxyWindowBase::disownWindow(bool keepItemOwnership) {
116117 return window;
117118}
118119
119- QQuickWindow * ProxyWindowBase::retrieveWindow (QObject* oldInstance) {
120+ ProxiedWindow * ProxyWindowBase::retrieveWindow (QObject* oldInstance) {
120121 auto * old = qobject_cast<ProxyWindowBase*>(oldInstance);
121122 return old == nullptr ? nullptr : old->disownWindow ();
122123}
@@ -136,6 +137,7 @@ void ProxyWindowBase::connectWindow() {
136137 QObject::connect (this ->window , &QWindow::heightChanged, this , &ProxyWindowBase::heightChanged);
137138 QObject::connect (this ->window , &QWindow::screenChanged, this , &ProxyWindowBase::screenChanged);
138139 QObject::connect (this ->window , &QQuickWindow::colorChanged, this , &ProxyWindowBase::colorChanged);
140+ QObject::connect (this ->window , &ProxiedWindow::exposed, this , &ProxyWindowBase::onWindowExposeEvent);
139141 // clang-format on
140142}
141143
@@ -215,7 +217,9 @@ void ProxyWindowBase::polishItems() {
215217 // This hack manually polishes the item tree right before showing the window so it will
216218 // always be created with the correct size.
217219 QQuickWindowPrivate::get (this ->window )->polishItems ();
220+ }
218221
222+ void ProxyWindowBase::onWindowExposeEvent () {
219223 if (!this ->ranLints ) {
220224 qs::debug::lintItemTree (this ->mContentItem );
221225 this ->ranLints = true ;
@@ -368,3 +372,8 @@ void ProxyWindowBase::onHeightChanged() { this->mContentItem->setHeight(this->he
368372
369373QObject* ProxyWindowAttached::window () const { return this ->mWindow ; }
370374QQuickItem* ProxyWindowAttached::contentItem () const { return this ->mWindow ->contentItem (); }
375+
376+ void ProxiedWindow::exposeEvent (QExposeEvent* event) {
377+ this ->QQuickWindow ::exposeEvent (event);
378+ emit this ->exposed ();
379+ }
0 commit comments