diff options
author | Michael Dominic K <mdk@codethink.co.uk> | 2010-11-17 09:55:08 (GMT) |
---|---|---|
committer | Samuel Rødal <samuel.rodal@nokia.com> | 2010-11-17 10:41:53 (GMT) |
commit | b2a89cf4049e425553bfe74bcb1a52433e6a13c7 (patch) | |
tree | 9520cd9f3f92cd7535207c91e46a18a94806d170 /tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp | |
parent | 7edbd71fb5399e73af170c62fff2bcd753bc6c55 (diff) | |
download | Qt-b2a89cf4049e425553bfe74bcb1a52433e6a13c7.zip Qt-b2a89cf4049e425553bfe74bcb1a52433e6a13c7.tar.gz Qt-b2a89cf4049e425553bfe74bcb1a52433e6a13c7.tar.bz2 |
Send QMeeGoSwitchEvent to toplevel widgets before switching graphics system.
Merge-request: 926
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp')
-rw-r--r-- | tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp index d348e70..b660eb3 100644 --- a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp +++ b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp @@ -46,6 +46,7 @@ #include <private/qgraphicssystem_runtime_p.h> #include <private/qpixmap_raster_p.h> #include "qmeegoruntime.h" +#include "qmeegoswitchevent.h" QString QMeeGoGraphicsSystemHelper::runningGraphicsSystemName() { @@ -81,8 +82,16 @@ void QMeeGoGraphicsSystemHelper::switchToMeeGo() if (QApplicationPrivate::instance()->graphics_system_name != QLatin1String("runtime")) qWarning("Can't switch to meego - switching only supported with 'runtime' graphics system."); else { + QMeeGoSwitchEvent willSwitchEvent(QLatin1String("meego"), QMeeGoSwitchEvent::WillSwitch); + foreach (QWidget *widget, QApplication::topLevelWidgets()) + QCoreApplication::sendEvent(widget, &willSwitchEvent); + QApplication *app = static_cast<QApplication *>(QCoreApplication::instance()); app->setGraphicsSystem(QLatin1String("meego")); + + QMeeGoSwitchEvent didSwitchEvent(QLatin1String("meego"), QMeeGoSwitchEvent::DidSwitch); + foreach (QWidget *widget, QApplication::topLevelWidgets()) + QCoreApplication::sendEvent(widget, &didSwitchEvent); } } @@ -94,8 +103,16 @@ void QMeeGoGraphicsSystemHelper::switchToRaster() if (QApplicationPrivate::instance()->graphics_system_name != QLatin1String("runtime")) qWarning("Can't switch to raster - switching only supported with 'runtime' graphics system."); else { + QMeeGoSwitchEvent willSwitchEvent(QLatin1String("raster"), QMeeGoSwitchEvent::WillSwitch); + foreach (QWidget *widget, QApplication::topLevelWidgets()) + QCoreApplication::sendEvent(widget, &willSwitchEvent); + QApplication *app = static_cast<QApplication *>(QCoreApplication::instance()); app->setGraphicsSystem(QLatin1String("raster")); + + QMeeGoSwitchEvent didSwitchEvent(QLatin1String("raster"), QMeeGoSwitchEvent::DidSwitch); + foreach (QWidget *widget, QApplication::topLevelWidgets()) + QCoreApplication::sendEvent(widget, &didSwitchEvent); } } |