summaryrefslogtreecommitdiffstats
path: root/tools/qml/qmlruntime.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/qml/qmlruntime.cpp')
-rw-r--r--tools/qml/qmlruntime.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp
index d49b0f1..06fa004 100644
--- a/tools/qml/qmlruntime.cpp
+++ b/tools/qml/qmlruntime.cpp
@@ -535,6 +535,8 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags)
connect(&autoStartTimer, SIGNAL(triggered()), this, SLOT(autoStartRecording()));
connect(&autoStopTimer, SIGNAL(triggered()), this, SLOT(autoStopRecording()));
connect(&recordTimer, SIGNAL(triggered()), this, SLOT(recordFrame()));
+ connect(DeviceOrientation::instance(), SIGNAL(orientationChanged()),
+ this, SLOT(orientationChanged()), Qt::QueuedConnection);
autoStartTimer.setRunning(false);
autoStopTimer.setRunning(false);
recordTimer.setRunning(false);
@@ -968,10 +970,8 @@ void QDeclarativeViewer::statusChanged()
if (canvas->status() == QDeclarativeView::Ready) {
initialSize = canvas->sizeHint();
if (canvas->resizeMode() == QDeclarativeView::SizeRootObjectToView) {
- QSize newWindowSize = initialSize;
- newWindowSize.setHeight(newWindowSize.height()+menuBarHeight());
updateSizeHints();
- resize(newWindowSize);
+ resize(QSize(initialSize.width(), initialSize.height()+menuBarHeight()));
}
}
}
@@ -1425,6 +1425,19 @@ void QDeclarativeViewer::recordFrame()
}
}
+void QDeclarativeViewer::orientationChanged()
+{
+ if (canvas->resizeMode() == QDeclarativeView::SizeRootObjectToView) {
+ if (canvas->rootObject()) {
+ QSizeF rootObjectSize = canvas->rootObject()->boundingRect().size();
+ QSize newSize(rootObjectSize.width(), rootObjectSize.height()+menuBarHeight());
+ if (size() != newSize) {
+ resize(newSize);
+ }
+ }
+ }
+}
+
void QDeclarativeViewer::setDeviceKeys(bool on)
{
devicemode = on;