diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-05-02 06:05:08 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-05-02 06:05:08 (GMT) |
commit | 2d6258a30f4326b600ccdd7cf1cbf9afcc0a7972 (patch) | |
tree | 262b13fb969e662a05eaf81734c359f961c66e4c /src/gui/kernel | |
parent | f101d46ccd4795fc672b5b6c9e24151df319d725 (diff) | |
parent | 7af6dac10b35abe9d94f27af19b720a7be2b9bee (diff) | |
download | Qt-2d6258a30f4326b600ccdd7cf1cbf9afcc0a7972.zip Qt-2d6258a30f4326b600ccdd7cf1cbf9afcc0a7972.tar.gz Qt-2d6258a30f4326b600ccdd7cf1cbf9afcc0a7972.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2:
Fix project file generation for MSVC 2010
Fix wrong translation and clip for the raster paint-engine on Mac
Return the correct library name in qt_gl_library_name for GLES*
qmake: remove useless evaluation of variables from VS project generators
Fix QT_NO_LIBRARY
Documentation for the Elastic Nodes example.
qmake: fix duplicate linker options in VS project files
Ensured that WA_InputMethodEnabled was set before FocusInEvent was sent.
qmake: fix duplicate compiler options in VS project files
Documentation for the Drag and Drop Robot example.
Fix crash in styles example when running with opengl graphicssystem
Fixed the sizehint for cols/rows in qtableview
QUrl: parsing of host name with an undercore.
Null pointer check
Revert "Try to use multisampled opengl graphicssystem on all platforms"
A small mistake when comparing the flag.
Add unit tests covering most of QVector's API.
Fix crash when CoreText fails to shape text for us
Fix crash when using opengl graphicssystem on desktop
Revert "Revert "Implement heightForWidth support for QTabWidget and QStackedLayout.""
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qguiplatformplugin.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qlayoutitem.cpp | 4 | ||||
-rw-r--r-- | src/gui/kernel/qstackedlayout.cpp | 26 | ||||
-rw-r--r-- | src/gui/kernel/qstackedlayout.h | 2 | ||||
-rw-r--r-- | src/gui/kernel/qwidget.cpp | 17 | ||||
-rw-r--r-- | src/gui/kernel/qwidget.h | 1 | ||||
-rw-r--r-- | src/gui/kernel/qwidget_p.h | 1 |
7 files changed, 49 insertions, 4 deletions
diff --git a/src/gui/kernel/qguiplatformplugin.cpp b/src/gui/kernel/qguiplatformplugin.cpp index c4119af..2dd251b 100644 --- a/src/gui/kernel/qguiplatformplugin.cpp +++ b/src/gui/kernel/qguiplatformplugin.cpp @@ -81,7 +81,7 @@ QGuiPlatformPlugin *qt_guiPlatformPlugin() static QGuiPlatformPlugin *plugin; if (!plugin) { -#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) +#ifndef QT_NO_LIBRARY QString key = QString::fromLocal8Bit(qgetenv("QT_PLATFORM_PLUGIN")); #ifdef Q_WS_X11 diff --git a/src/gui/kernel/qlayoutitem.cpp b/src/gui/kernel/qlayoutitem.cpp index 6a91d95..e615b2d 100644 --- a/src/gui/kernel/qlayoutitem.cpp +++ b/src/gui/kernel/qlayoutitem.cpp @@ -516,9 +516,7 @@ bool QWidgetItem::hasHeightForWidth() const { if (isEmpty()) return false; - if (wid->layout()) - return wid->layout()->hasHeightForWidth(); - return wid->sizePolicy().hasHeightForWidth(); + return wid->hasHeightForWidth(); } /*! diff --git a/src/gui/kernel/qstackedlayout.cpp b/src/gui/kernel/qstackedlayout.cpp index 7559066..4b49638 100644 --- a/src/gui/kernel/qstackedlayout.cpp +++ b/src/gui/kernel/qstackedlayout.cpp @@ -475,6 +475,32 @@ void QStackedLayout::setGeometry(const QRect &rect) } } +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; +} + +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 diff --git a/src/gui/kernel/qstackedlayout.h b/src/gui/kernel/qstackedlayout.h index c069149..842b62b 100644 --- a/src/gui/kernel/qstackedlayout.h +++ b/src/gui/kernel/qstackedlayout.h @@ -95,6 +95,8 @@ public: QLayoutItem *itemAt(int) const; QLayoutItem *takeAt(int); void setGeometry(const QRect &rect); + bool hasHeightForWidth() const; + int heightForWidth(int width) const; Q_SIGNALS: void widgetRemoved(int index); diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 20d1d30..399a27b 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -3825,6 +3825,11 @@ void QWidget::setMaximumSize(int maxw, int maxh) d->updateGeometry_helper(d->extra->minw == d->extra->maxw && d->extra->minh == d->extra->maxh); } +bool QWidgetPrivate::hasHeightForWidth() const +{ + return layout ? layout->hasHeightForWidth() : size_policy.hasHeightForWidth(); +} + /*! \overload @@ -7970,6 +7975,18 @@ QSize QWidget::minimumSizeHint() const return QSize(-1, -1); } +/*! + \internal + This is a bit hackish, but ideally this would have been a virtual + function so that subclasses could reimplement their own function. + Instead we add a virtual function to QWidgetPrivate. +*/ +bool QWidget::hasHeightForWidth() const +{ + Q_D(const QWidget); + return d->hasHeightForWidth(); +} + /*! \fn QWidget *QWidget::parentWidget() const diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h index e12148b..6e5de7d 100644 --- a/src/gui/kernel/qwidget.h +++ b/src/gui/kernel/qwidget.h @@ -524,6 +524,7 @@ public: virtual QSize sizeHint() const; virtual QSize minimumSizeHint() const; + bool hasHeightForWidth() const; QSizePolicy sizePolicy() const; void setSizePolicy(QSizePolicy); diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index cad60b5..9926b2c 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -493,6 +493,7 @@ public: bool setMinimumSize_helper(int &minw, int &minh); bool setMaximumSize_helper(int &maxw, int &maxh); + virtual bool hasHeightForWidth() const; void setConstraints_sys(); QWidget *childAt_helper(const QPoint &, bool) const; void updateGeometry_helper(bool forceUpdate); |