summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@jollamobile.com>2013-03-27 09:36:40 +0000
committerRobin Burchell <robin+qt@viroteck.net>2013-04-03 00:12:03 +0200
commit770354700d35a713fe5c35dc4e96ab5675443a20 (patch)
tree502627a248801e7af6d287746202c4febd65fe3a
parent27697b3819d1b33bec6e32ba53a7e83fc25a66ec (diff)
Don't create event loop in quick_test_main() if it exists already
An application using quicktestlib might wish to tweak the event loop to make it compatible with another event loop used in component under test. Change-Id: Ifc5fa3992e969044772a13df7aef997ba5625181 Done-with: Dmitry Rozhkov <dmitry.rozhkov@jollamobile.com> Reviewed-by: Matthew Vogt <matthew.vogt@qinetic.com.au>
-rw-r--r--src/quicktestlib/quicktest.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/quicktestlib/quicktest.cpp b/src/quicktestlib/quicktest.cpp
index 147f4fb..ef38b9f 100644
--- a/src/quicktestlib/quicktest.cpp
+++ b/src/quicktestlib/quicktest.cpp
@@ -111,7 +111,8 @@ static inline QString stripQuotes(const QString &s)
int quick_test_main(int argc, char **argv, const char *name, quick_test_viewport_create createViewport, const char *sourceDir)
{
- QApplication app(argc, argv);
+ // qApp might be already created in main application which is using quicktestlib
+ QScopedPointer<QApplication> app(qApp ? qApp : new QApplication(argc, argv));
// Look for QML-specific command-line options.
// -import dir Specify an import directory.