forked from quickshell/quickshell
core/window: add title property to floating windows
This commit is contained in:
parent
20322484b9
commit
d9164578a2
2 changed files with 20 additions and 0 deletions
|
@ -13,6 +13,7 @@
|
|||
void ProxyFloatingWindow::connectWindow() {
|
||||
this->ProxyWindowBase::connectWindow();
|
||||
|
||||
this->window->setTitle(this->bTitle);
|
||||
this->window->setMinimumSize(this->bMinimumSize);
|
||||
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() {
|
||||
if (this->window) this->window->setMinimumSize(this->bMinimumSize);
|
||||
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::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::maximumSizeChanged, this, &FloatingWindowInterface::maximumSizeChanged);
|
||||
// clang-format on
|
||||
|
|
|
@ -24,12 +24,21 @@ public:
|
|||
signals:
|
||||
void minimumSizeChanged();
|
||||
void maximumSizeChanged();
|
||||
void titleChanged();
|
||||
|
||||
private:
|
||||
void onMinimumSizeChanged();
|
||||
void onMaximumSizeChanged();
|
||||
void onTitleChanged();
|
||||
|
||||
public:
|
||||
Q_OBJECT_BINDABLE_PROPERTY(
|
||||
ProxyFloatingWindow,
|
||||
QString,
|
||||
bTitle,
|
||||
&ProxyFloatingWindow::onTitleChanged
|
||||
);
|
||||
|
||||
Q_OBJECT_BINDABLE_PROPERTY(
|
||||
ProxyFloatingWindow,
|
||||
QSize,
|
||||
|
@ -49,6 +58,8 @@ public:
|
|||
class FloatingWindowInterface: public WindowInterface {
|
||||
Q_OBJECT;
|
||||
// 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.
|
||||
Q_PROPERTY(QSize minimumSize READ default WRITE default NOTIFY minimumSizeChanged BINDABLE bindableMinimumSize);
|
||||
/// Maximum window size given to the window system.
|
||||
|
@ -100,10 +111,12 @@ public:
|
|||
|
||||
QBindable<QSize> bindableMinimumSize() { return &this->window->bMinimumSize; }
|
||||
QBindable<QSize> bindableMaximumSize() { return &this->window->bMaximumSize; }
|
||||
QBindable<QString> bindableTitle() { return &this->window->bTitle; }
|
||||
|
||||
signals:
|
||||
void minimumSizeChanged();
|
||||
void maximumSizeChanged();
|
||||
void titleChanged();
|
||||
|
||||
private:
|
||||
ProxyFloatingWindow* window;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue