diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qwindow.cpp | 50 | ||||
-rw-r--r-- | src/gui/kernel/qwindow.h | 19 | ||||
-rw-r--r-- | src/gui/kernel/qwindow_p.h | 1 |
3 files changed, 70 insertions, 0 deletions
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index a17270912f..d845be3d01 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -941,9 +941,24 @@ void QWindow::setMinimumSize(const QSize &size) QSize adjustedSize = QSize(qBound(0, size.width(), QWINDOWSIZE_MAX), qBound(0, size.height(), QWINDOWSIZE_MAX)); if (d->minimumSize == adjustedSize) return; + QSize oldSize = d->minimumSize; d->minimumSize = adjustedSize; if (d->platformWindow && isTopLevel()) d->platformWindow->propagateSizeHints(); + if (d->minimumSize.width() != oldSize.width()) + emit minimumWidthChanged(d->minimumSize.width()); + if (d->minimumSize.height() != oldSize.height()) + emit minimumHeightChanged(d->minimumSize.height()); +} + +void QWindow::setMinimumWidth(int w) +{ + setMinimumSize(QSize(w, minimumHeight())); +} + +void QWindow::setMinimumHeight(int h) +{ + setMinimumSize(QSize(minimumWidth(), h)); } /*! @@ -959,9 +974,24 @@ void QWindow::setMaximumSize(const QSize &size) QSize adjustedSize = QSize(qBound(0, size.width(), QWINDOWSIZE_MAX), qBound(0, size.height(), QWINDOWSIZE_MAX)); if (d->maximumSize == adjustedSize) return; + QSize oldSize = d->maximumSize; d->maximumSize = adjustedSize; if (d->platformWindow && isTopLevel()) d->platformWindow->propagateSizeHints(); + if (d->maximumSize.width() != oldSize.width()) + emit maximumWidthChanged(d->maximumSize.width()); + if (d->maximumSize.height() != oldSize.height()) + emit maximumHeightChanged(d->maximumSize.height()); +} + +void QWindow::setMaximumWidth(int w) +{ + setMaximumSize(QSize(w, maximumHeight())); +} + +void QWindow::setMaximumHeight(int h) +{ + setMaximumSize(QSize(maximumWidth(), h)); } /*! @@ -1060,6 +1090,26 @@ void QWindow::setGeometry(const QRect &rect) */ /*! + \property QWindow::minimumWidth + \brief the minimum width of the window's geometry +*/ + +/*! + \property QWindow::minimumHeight + \brief the minimum height of the window's geometry +*/ + +/*! + \property QWindow::maximumWidth + \brief the maximum width of the window's geometry +*/ + +/*! + \property QWindow::maximumHeight + \brief the maximum height of the window's geometry +*/ + +/*! Returns the geometry of the window, excluding its window frame. \sa frameMargins(), frameGeometry() diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h index 62268cd88a..4832adfb63 100644 --- a/src/gui/kernel/qwindow.h +++ b/src/gui/kernel/qwindow.h @@ -104,6 +104,10 @@ class Q_GUI_EXPORT QWindow : public QObject, public QSurface Q_PROPERTY(QPoint pos READ pos WRITE setPos) Q_PROPERTY(QSize size READ size WRITE resize) Q_PROPERTY(QRect geometry READ geometry WRITE setGeometry) + Q_PROPERTY(int minimumWidth READ minimumWidth WRITE setMinimumWidth NOTIFY minimumWidthChanged) + Q_PROPERTY(int minimumHeight READ minimumHeight WRITE setMinimumHeight NOTIFY minimumHeightChanged) + Q_PROPERTY(int maximumWidth READ maximumWidth WRITE setMaximumWidth NOTIFY maximumWidthChanged) + Q_PROPERTY(int maximumHeight READ maximumHeight WRITE setMaximumHeight NOTIFY maximumHeightChanged) Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged) Q_PROPERTY(Qt::ScreenOrientation contentOrientation READ contentOrientation WRITE reportContentOrientationChange NOTIFY contentOrientationChanged) #ifndef QT_NO_CURSOR @@ -170,6 +174,11 @@ public: bool isExposed() const; + int minimumWidth() const { return minimumSize().width(); } + int minimumHeight() const { return minimumSize().height(); } + int maximumWidth() const { return maximumSize().width(); } + int maximumHeight() const { return maximumSize().height(); } + QSize minimumSize() const; QSize maximumSize() const; QSize baseSize() const; @@ -273,6 +282,11 @@ public Q_SLOTS: setGeometry(QRect(x(), y(), width(), arg)); } + void setMinimumWidth(int w); + void setMinimumHeight(int h); + void setMaximumWidth(int w); + void setMaximumHeight(int h); + Q_SIGNALS: void screenChanged(QScreen *screen); void windowModalityChanged(Qt::WindowModality windowModality); @@ -283,6 +297,11 @@ Q_SIGNALS: void widthChanged(int arg); void heightChanged(int arg); + void minimumWidthChanged(int arg); + void minimumHeightChanged(int arg); + void maximumWidthChanged(int arg); + void maximumHeightChanged(int arg); + void visibleChanged(bool arg); void contentOrientationChanged(Qt::ScreenOrientation orientation); diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h index 159f05d1a5..bce6a4ff04 100644 --- a/src/gui/kernel/qwindow_p.h +++ b/src/gui/kernel/qwindow_p.h @@ -80,6 +80,7 @@ public: , positionPolicy(WindowFrameExclusive) , contentOrientation(Qt::PrimaryOrientation) , windowOrientation(Qt::PrimaryOrientation) + , minimumSize(0, 0) , maximumSize(QWINDOWSIZE_MAX, QWINDOWSIZE_MAX) , modality(Qt::NonModal) , blockedByModalWindow(false) |