forked from quickshell/quickshell
core/window: add min/max size to FloatingWindow
This commit is contained in:
parent
05ed9ff74c
commit
e931b85464
2 changed files with 61 additions and 0 deletions
|
|
@ -4,11 +4,19 @@
|
|||
#include <qqmlengine.h>
|
||||
#include <qqmllist.h>
|
||||
#include <qquickitem.h>
|
||||
#include <qtmetamacros.h>
|
||||
#include <qtypes.h>
|
||||
|
||||
#include "proxywindow.hpp"
|
||||
#include "windowinterface.hpp"
|
||||
|
||||
void ProxyFloatingWindow::connectWindow() {
|
||||
this->ProxyWindowBase::connectWindow();
|
||||
|
||||
this->window->setMinimumSize(this->bMinimumSize);
|
||||
this->window->setMaximumSize(this->bMaximumSize);
|
||||
}
|
||||
|
||||
void ProxyFloatingWindow::trySetWidth(qint32 implicitWidth) {
|
||||
if (!this->window->isVisible()) {
|
||||
this->ProxyWindowBase::trySetWidth(implicitWidth);
|
||||
|
|
@ -21,6 +29,16 @@ void ProxyFloatingWindow::trySetHeight(qint32 implicitHeight) {
|
|||
}
|
||||
}
|
||||
|
||||
void ProxyFloatingWindow::onMinimumSizeChanged() {
|
||||
if (this->window) this->window->setMinimumSize(this->bMinimumSize);
|
||||
emit this->minimumSizeChanged();
|
||||
}
|
||||
|
||||
void ProxyFloatingWindow::onMaximumSizeChanged() {
|
||||
if (this->window) this->window->setMaximumSize(this->bMaximumSize);
|
||||
emit this->maximumSizeChanged();
|
||||
}
|
||||
|
||||
// FloatingWindowInterface
|
||||
|
||||
FloatingWindowInterface::FloatingWindowInterface(QObject* parent)
|
||||
|
|
@ -40,6 +58,9 @@ FloatingWindowInterface::FloatingWindowInterface(QObject* parent)
|
|||
QObject::connect(this->window, &ProxyWindowBase::colorChanged, this, &FloatingWindowInterface::colorChanged);
|
||||
QObject::connect(this->window, &ProxyWindowBase::maskChanged, this, &FloatingWindowInterface::maskChanged);
|
||||
QObject::connect(this->window, &ProxyWindowBase::surfaceFormatChanged, this, &FloatingWindowInterface::surfaceFormatChanged);
|
||||
|
||||
QObject::connect(this->window, &ProxyFloatingWindow::minimumSizeChanged, this, &FloatingWindowInterface::minimumSizeChanged);
|
||||
QObject::connect(this->window, &ProxyFloatingWindow::maximumSizeChanged, this, &FloatingWindowInterface::maximumSizeChanged);
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue