core/window: add title property to floating windows

This commit is contained in:
outfoxxed 2025-06-15 03:12:51 -07:00
parent 20322484b9
commit d9164578a2
Signed by untrusted user: outfoxxed
GPG key ID: 4C88A185FB89301E
2 changed files with 20 additions and 0 deletions

View file

@ -13,6 +13,7 @@
void ProxyFloatingWindow::connectWindow() { void ProxyFloatingWindow::connectWindow() {
this->ProxyWindowBase::connectWindow(); this->ProxyWindowBase::connectWindow();
this->window->setTitle(this->bTitle);
this->window->setMinimumSize(this->bMinimumSize); this->window->setMinimumSize(this->bMinimumSize);
this->window->setMaximumSize(this->bMaximumSize); this->window->setMaximumSize(this->bMaximumSize);
} }
@ -29,6 +30,11 @@ void ProxyFloatingWindow::trySetHeight(qint32 implicitHeight) {
} }
} }
void ProxyFloatingWindow::onTitleChanged() {
if (this->window) this->window->setTitle(this->bTitle);
emit this->titleChanged();
}
void ProxyFloatingWindow::onMinimumSizeChanged() { void ProxyFloatingWindow::onMinimumSizeChanged() {
if (this->window) this->window->setMinimumSize(this->bMinimumSize); if (this->window) this->window->setMinimumSize(this->bMinimumSize);
emit this->minimumSizeChanged(); emit this->minimumSizeChanged();
@ -59,6 +65,7 @@ FloatingWindowInterface::FloatingWindowInterface(QObject* parent)
QObject::connect(this->window, &ProxyWindowBase::maskChanged, this, &FloatingWindowInterface::maskChanged); QObject::connect(this->window, &ProxyWindowBase::maskChanged, this, &FloatingWindowInterface::maskChanged);
QObject::connect(this->window, &ProxyWindowBase::surfaceFormatChanged, this, &FloatingWindowInterface::surfaceFormatChanged); QObject::connect(this->window, &ProxyWindowBase::surfaceFormatChanged, this, &FloatingWindowInterface::surfaceFormatChanged);
QObject::connect(this->window, &ProxyFloatingWindow::titleChanged, this, &FloatingWindowInterface::titleChanged);
QObject::connect(this->window, &ProxyFloatingWindow::minimumSizeChanged, this, &FloatingWindowInterface::minimumSizeChanged); QObject::connect(this->window, &ProxyFloatingWindow::minimumSizeChanged, this, &FloatingWindowInterface::minimumSizeChanged);
QObject::connect(this->window, &ProxyFloatingWindow::maximumSizeChanged, this, &FloatingWindowInterface::maximumSizeChanged); QObject::connect(this->window, &ProxyFloatingWindow::maximumSizeChanged, this, &FloatingWindowInterface::maximumSizeChanged);
// clang-format on // clang-format on

View file

@ -24,12 +24,21 @@ public:
signals: signals:
void minimumSizeChanged(); void minimumSizeChanged();
void maximumSizeChanged(); void maximumSizeChanged();
void titleChanged();
private: private:
void onMinimumSizeChanged(); void onMinimumSizeChanged();
void onMaximumSizeChanged(); void onMaximumSizeChanged();
void onTitleChanged();
public: public:
Q_OBJECT_BINDABLE_PROPERTY(
ProxyFloatingWindow,
QString,
bTitle,
&ProxyFloatingWindow::onTitleChanged
);
Q_OBJECT_BINDABLE_PROPERTY( Q_OBJECT_BINDABLE_PROPERTY(
ProxyFloatingWindow, ProxyFloatingWindow,
QSize, QSize,
@ -49,6 +58,8 @@ public:
class FloatingWindowInterface: public WindowInterface { class FloatingWindowInterface: public WindowInterface {
Q_OBJECT; Q_OBJECT;
// clang-format off // clang-format off
/// Window title.
Q_PROPERTY(QString title READ default WRITE default NOTIFY titleChanged BINDABLE bindableTitle);
/// Minimum window size given to the window system. /// Minimum window size given to the window system.
Q_PROPERTY(QSize minimumSize READ default WRITE default NOTIFY minimumSizeChanged BINDABLE bindableMinimumSize); Q_PROPERTY(QSize minimumSize READ default WRITE default NOTIFY minimumSizeChanged BINDABLE bindableMinimumSize);
/// Maximum window size given to the window system. /// Maximum window size given to the window system.
@ -100,10 +111,12 @@ public:
QBindable<QSize> bindableMinimumSize() { return &this->window->bMinimumSize; } QBindable<QSize> bindableMinimumSize() { return &this->window->bMinimumSize; }
QBindable<QSize> bindableMaximumSize() { return &this->window->bMaximumSize; } QBindable<QSize> bindableMaximumSize() { return &this->window->bMaximumSize; }
QBindable<QString> bindableTitle() { return &this->window->bTitle; }
signals: signals:
void minimumSizeChanged(); void minimumSizeChanged();
void maximumSizeChanged(); void maximumSizeChanged();
void titleChanged();
private: private:
ProxyFloatingWindow* window; ProxyFloatingWindow* window;