diff options
author | Debao Zhang <dbzhang800@gmail.com> | 2012-03-02 15:42:35 -0800 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-05 07:54:44 +0100 |
commit | 07ae18f96e87a2db40ae014f28893f1080efa7ae (patch) | |
tree | 967b125d67a07a2a4f7ee38d0a227173a99d5ffa /src/widgets/kernel/qstackedlayout.cpp | |
parent | fb8c95bac09910c4dfa476ab97c6206b2e94ee53 (diff) |
Implements QStackedLayout's hfw-related methods.
QStackedLayout does not support height for width (simply because it does
not reimplement heightForWidth() and hasHeightForWidth()). That is not
possible to fix without breaking binary compatibility under Qt4, which
use a modified version of QStackedLayout that reimplements the hfw-related
functions as a workaround.
Change-Id: I81c795f0c247a2e708292de35f0650384248c6cd
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'src/widgets/kernel/qstackedlayout.cpp')
-rw-r--r-- | src/widgets/kernel/qstackedlayout.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/widgets/kernel/qstackedlayout.cpp b/src/widgets/kernel/qstackedlayout.cpp index 9b40063e65..0d2e7716e5 100644 --- a/src/widgets/kernel/qstackedlayout.cpp +++ b/src/widgets/kernel/qstackedlayout.cpp @@ -477,6 +477,38 @@ void QStackedLayout::setGeometry(const QRect &rect) } /*! + \reimp +*/ +bool QStackedLayout::hasHeightForWidth() const +{ + const int n = count(); + + for (int i = 0; i < n; ++i) { + if (QLayoutItem *item = itemAt(i)) { + if (item->hasHeightForWidth()) + return true; + } + } + return false; +} + +/*! + \reimp +*/ +int QStackedLayout::heightForWidth(int width) const +{ + const int n = count(); + + int hfw = 0; + for (int i = 0; i < n; ++i) { + if (QLayoutItem *item = itemAt(i)) { + hfw = qMax(hfw, item->heightForWidth(width)); + } + } + return hfw; +} + +/*! \enum QStackedLayout::StackingMode \since 4.4 |