diff options
author | Robert Griebl <robert.griebl@nokia.com> | 2010-06-24 16:37:32 (GMT) |
---|---|---|
committer | Kai Koehne <kai.koehne@nokia.com> | 2010-06-25 06:41:15 (GMT) |
commit | 9768a42358d1908701347d52887a964574b1b9b4 (patch) | |
tree | e7846dc8ae257d0d1843faef528b0221617f16b9 /tools | |
parent | 7294f46ec0c5ea07e438c45a069a618ceb6e17a9 (diff) | |
download | Qt-9768a42358d1908701347d52887a964574b1b9b4.zip Qt-9768a42358d1908701347d52887a964574b1b9b4.tar.gz Qt-9768a42358d1908701347d52887a964574b1b9b4.tar.bz2 |
fix QML Viewer resize modes
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qml/qmlruntime.cpp | 10 | ||||
-rw-r--r-- | tools/qml/qmlruntime.h | 3 |
2 files changed, 8 insertions, 5 deletions
diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp index 3a8af60..109de7d 100644 --- a/tools/qml/qmlruntime.cpp +++ b/tools/qml/qmlruntime.cpp @@ -937,8 +937,8 @@ void QDeclarativeViewer::statusChanged() if (canvas->resizeMode() == QDeclarativeView::SizeRootObjectToView) { if (!isFullScreen() && !isMaximized()) { canvas->setFixedSize(initialSize); - resize(1, 1); // workaround for QMainWindowLayout NOT shrinking the window if the centralWidget() shrinks - updateSizeHints(); + resize(1, 1); // workaround for QMainWindowLayout NOT shrinking the window if the centralWidget() shrink + QTimer::singleShot(0, this, SLOT(updateSizeHints())); } } } @@ -1328,7 +1328,8 @@ void QDeclarativeViewer::orientationChanged() if (canvas->rootObject()) { QSizeF rootObjectSize = canvas->rootObject()->boundingRect().size(); if (size() != rootObjectSize.toSize()) { - canvas->setFixedSize(rootObjectSize.toSize()); + canvas->setMinimumSize(rootObjectSize.toSize()); + canvas->resize(rootObjectSize.toSize()); resize(1, 1); // workaround for QMainWindowLayout NOT shrinking the window if the centralWidget() shrinks } } @@ -1384,7 +1385,8 @@ void QDeclarativeViewer::updateSizeHints() if (canvas->resizeMode() == QDeclarativeView::SizeViewToRootObject) { QSize newWindowSize = canvas->sizeHint(); if (!isFullScreen() && !isMaximized()) { - canvas->setFixedSize(newWindowSize); + canvas->setMinimumSize(newWindowSize); + canvas->resize(newWindowSize); resize(1, 1); // workaround for QMainWindowLayout NOT shrinking the window if the centralWidget() shrinks } } else { // QDeclarativeView::SizeRootObjectToView diff --git a/tools/qml/qmlruntime.h b/tools/qml/qmlruntime.h index cb1b438..cec3204 100644 --- a/tools/qml/qmlruntime.h +++ b/tools/qml/qmlruntime.h @@ -102,7 +102,6 @@ public: void addPluginPath(const QString& plugin); void setUseGL(bool use); void setUseNativeFileBrowser(bool); - void updateSizeHints(); void setSizeToView(bool sizeToView); QDeclarativeView *view() const; @@ -145,6 +144,8 @@ private slots: void warningsWidgetOpened(); void warningsWidgetClosed(); + void updateSizeHints(); + private: QString getVideoFileName(); |