From 7c4287c9c36bf5382799eac6f6ceb97d4cec3f6f Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 11 Nov 2009 09:48:18 +1000 Subject: Add ability for viewer to slow down animations. This is useful for debugging complex transitions. --- tools/qmlviewer/qmlviewer.cpp | 15 +++++++++++++++ tools/qmlviewer/qmlviewer.h | 1 + 2 files changed, 16 insertions(+) diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qmlviewer/qmlviewer.cpp index b6a3627..ea0936b 100644 --- a/tools/qmlviewer/qmlviewer.cpp +++ b/tools/qmlviewer/qmlviewer.cpp @@ -413,6 +413,16 @@ void QmlViewer::createMenu(QMenuBar *menu, QMenu *flatmenu) if (flatmenu) flatmenu->addSeparator(); + QMenu *debugMenu = flatmenu ? flatmenu->addMenu(tr("&Debugging")) : menu->addMenu(tr("&Debugging")); + + QAction *slowAction = new QAction(tr("&Slow Down Animations"), parent); + slowAction->setShortcut(QKeySequence("Ctrl+.")); + slowAction->setCheckable(true); + connect(slowAction, SIGNAL(triggered(bool)), this, SLOT(setSlowMode(bool))); + debugMenu->addAction(slowAction); + + if (flatmenu) flatmenu->addSeparator(); + QMenu *skinMenu = flatmenu ? flatmenu->addMenu(tr("&Skin")) : menu->addMenu(tr("&Skin")); QActionGroup *skinActions; @@ -627,6 +637,11 @@ void QmlViewer::toggleRecording() setRecording(recording); } +void QmlViewer::setSlowMode(bool enable) +{ + QUnifiedTimer::instance()->setSlowModeEnabled(enable); +} + void QmlViewer::addLibraryPath(const QString& lib) { canvas->engine()->addImportPath(lib); diff --git a/tools/qmlviewer/qmlviewer.h b/tools/qmlviewer/qmlviewer.h index b366401..78512a9 100644 --- a/tools/qmlviewer/qmlviewer.h +++ b/tools/qmlviewer/qmlviewer.h @@ -104,6 +104,7 @@ public slots: void proxySettingsChanged (); void setScaleView(); void executeErrors(); + void setSlowMode(bool); protected: virtual void keyPressEvent(QKeyEvent *); -- cgit v0.12 From 24ee7d2fe5481658f350172b9c211bc3b4d89a65 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 11 Nov 2009 09:57:25 +1000 Subject: Fix failing test. --- tests/auto/declarative/anchors/data/anchors.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/declarative/anchors/data/anchors.qml b/tests/auto/declarative/anchors/data/anchors.qml index b3fba30..b880762 100644 --- a/tests/auto/declarative/anchors/data/anchors.qml +++ b/tests/auto/declarative/anchors/data/anchors.qml @@ -97,7 +97,7 @@ Rectangle { id: rect18; objectName: "rect18" x: 180; width: 10 anchors.top: masterRect.bottom - anchors.bottom: Rect12.top + anchors.bottom: rect12.top } Rectangle { id: rect19; objectName: "rect19" -- cgit v0.12