diff options
author | Samuel Rødal <samuel.rodal@digia.com> | 2012-11-01 17:03:45 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-11-02 12:16:49 +0100 |
commit | f01b498310ea7c05ec73669b34cb83b9f159006f (patch) | |
tree | 43bf9895d85ac8ca405ba1041bec23bd44aaa3e1 /src/gui/kernel/qwindow.cpp | |
parent | 774b643b850d770f16d04856aa613ebf394f913b (diff) |
Introduced QWindow properties {min/max}imum{Width/Height}
These are useful when QWindow is exposed to QML.
Change-Id: I7ec49ef365183e2c784605889e8ea22c2ef34781
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Diffstat (limited to 'src/gui/kernel/qwindow.cpp')
-rw-r--r-- | src/gui/kernel/qwindow.cpp | 50 |
1 files changed, 50 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() |