popups: add popup windows

This commit is contained in:
outfoxxed 2024-03-11 05:44:56 -07:00
parent 8cf0659444
commit b675b3676c
Signed by untrusted user: outfoxxed
GPG key ID: 4C88A185FB89301E
20 changed files with 586 additions and 71 deletions

View file

@ -61,6 +61,8 @@ QQuickWindow* ProxyWindowBase::createWindow(QObject* oldInstance) {
void ProxyWindowBase::setupWindow() {
// clang-format off
QObject::connect(this->window, &QWindow::visibilityChanged, this, &ProxyWindowBase::visibleChanged);
QObject::connect(this->window, &QWindow::xChanged, this, &ProxyWindowBase::xChanged);
QObject::connect(this->window, &QWindow::yChanged, this, &ProxyWindowBase::yChanged);
QObject::connect(this->window, &QWindow::widthChanged, this, &ProxyWindowBase::widthChanged);
QObject::connect(this->window, &QWindow::heightChanged, this, &ProxyWindowBase::heightChanged);
QObject::connect(this->window, &QWindow::screenChanged, this, &ProxyWindowBase::screenChanged);
@ -76,6 +78,10 @@ void ProxyWindowBase::setupWindow() {
this->setHeight(this->mHeight);
this->setColor(this->mColor);
this->updateMask();
// notify initial x and y positions
emit this->xChanged();
emit this->yChanged();
}
QQuickWindow* ProxyWindowBase::disownWindow() {
@ -103,6 +109,16 @@ void ProxyWindowBase::setVisible(bool visible) {
} else this->window->setVisible(visible);
}
qint32 ProxyWindowBase::x() const {
if (this->window == nullptr) return 0;
else return this->window->x();
}
qint32 ProxyWindowBase::y() const {
if (this->window == nullptr) return 0;
else return this->window->y();
}
qint32 ProxyWindowBase::width() const {
if (this->window == nullptr) return this->mWidth;
else return this->window->width();