From 01ecc29ad3f737fb8e1cc3a33dfa4687cd74c1a5 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Fri, 14 Aug 2009 09:39:14 +0300 Subject: Implemented minimalistic modal handling for Symbian OS. The implementation is likely not complete, but makes autotests using QApplication::activeModalWidget to pass. At least the following test now pass successfully: qcolordialog qmessagebox Might have positive impact to other autotests as well. --- src/gui/kernel/qapplication_s60.cpp | 24 +++++++++++++++++------- tests/auto/_Categories/QtGui.txt | 2 +- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index db78349..44ac380 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -75,10 +75,11 @@ QT_BEGIN_NAMESPACE #if defined(QT_DEBUG) static bool appNoGrab = false; // Grabbing enabled #endif - +static bool app_do_modal = false; // modal mode Q_GLOBAL_STATIC(QS60Data, qt_s60Data); -extern bool qt_sendSpontaneousEvent(QObject*,QEvent*); +extern bool qt_sendSpontaneousEvent(QObject*,QEvent*); +extern QWidgetList *qt_modal_stack; // stack of modal widgets extern QDesktopWidget *qt_desktopWidget; // qapplication.cpp QWidget *qt_button_down = 0; // widget got last button-down @@ -788,17 +789,26 @@ QString QApplicationPrivate::appName() const bool QApplicationPrivate::modalState() { - return false; + return app_do_modal; } -void QApplicationPrivate::enterModal_sys(QWidget * /* widget */) +void QApplicationPrivate::enterModal_sys(QWidget *widget) { - // TODO: Implement QApplicationPrivate::enterModal_sys(QWidget *widget) + if (!qt_modal_stack) + qt_modal_stack = new QWidgetList; + qt_modal_stack->insert(0, widget); + app_do_modal = true; } -void QApplicationPrivate::leaveModal_sys(QWidget * /* widget */) +void QApplicationPrivate::leaveModal_sys(QWidget *widget) { - // TODO: Implement QApplicationPrivate::leaveModal_sys(QWidget *widget) + if (qt_modal_stack && qt_modal_stack->removeAll(widget)) { + if (qt_modal_stack->isEmpty()) { + delete qt_modal_stack; + qt_modal_stack = 0; + } + } + app_do_modal = qt_modal_stack != 0; } void QApplicationPrivate::openPopup(QWidget *popup) diff --git a/tests/auto/_Categories/QtGui.txt b/tests/auto/_Categories/QtGui.txt index 495a173..a50dd0c 100644 --- a/tests/auto/_Categories/QtGui.txt +++ b/tests/auto/_Categories/QtGui.txt @@ -100,7 +100,7 @@ qmainwindow #qmdisubwindow not relevant for S60, skip for now qmenu qmenubar -#qmessagebox that's a hanger +qmessagebox qmouseevent qmouseevent_modal qmovie -- cgit v0.12 From 7d68b34a1f261b2b23400fddcf46d6521eae32d1 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Fri, 14 Aug 2009 09:47:41 +0300 Subject: Fixed and re-enabled anguagechange autotest for Symbian. Started to use QApplication::closeAllWindows instead of unexported QThreadData::current() and friends. --- tests/auto/_Categories/QtGui.txt | 2 +- tests/auto/languagechange/tst_languagechange.cpp | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/tests/auto/_Categories/QtGui.txt b/tests/auto/_Categories/QtGui.txt index a50dd0c..d8af499 100644 --- a/tests/auto/_Categories/QtGui.txt +++ b/tests/auto/_Categories/QtGui.txt @@ -1,6 +1,6 @@ exceptionsafety_objects #gestures This test is incomplete and also missing from auto.pro -> disabled for now -#languagechange Uses unexported method QThreadData::current() and also missing from auto.pro -> disabled for now +languagechange math3d modeltest qabstractbutton diff --git a/tests/auto/languagechange/tst_languagechange.cpp b/tests/auto/languagechange/tst_languagechange.cpp index 7cca3bf..7c98809 100644 --- a/tests/auto/languagechange/tst_languagechange.cpp +++ b/tests/auto/languagechange/tst_languagechange.cpp @@ -122,10 +122,7 @@ public slots: void install() { QCoreApplication::installTranslator(this); QTest::qWait(2500); - //### is there any better way to close a Qt dialog? - QThreadData *data = QThreadData::current(); - if (!data->eventLoops.isEmpty()) - data->eventLoops.top()->quit(); + QApplication::closeAllWindows(); } public: mutable QSet m_translations; -- cgit v0.12