aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-09-03 12:42:17 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-09-05 08:12:48 +0000
commit850f6e2f2f096541e3c02cc1030d3a7f7b9ae190 (patch)
treea2e8691d2b7bcd59628a3229f5e0250267fb7828 /examples
parent82a17dc90144459982be0ea28145ea8b5e1057a0 (diff)
texteditor: allow passing -touch as a command line argument
It was already possible to specify QT_FILE_SELECTORS=touch, but in Qt Creator, it's more convenient to specify a command line argument than an environment variable. Change-Id: I83a86aa88fb0c229d9bcedb6646351f0675db199 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'examples')
-rw-r--r--examples/quickcontrols2/texteditor/texteditor.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/examples/quickcontrols2/texteditor/texteditor.cpp b/examples/quickcontrols2/texteditor/texteditor.cpp
index 7fda4fa9..10ba675c 100644
--- a/examples/quickcontrols2/texteditor/texteditor.cpp
+++ b/examples/quickcontrols2/texteditor/texteditor.cpp
@@ -70,10 +70,17 @@ int main(int argc, char *argv[])
qmlRegisterType<DocumentHandler>("io.qt.examples.texteditor", 1, 0, "DocumentHandler");
- QQmlApplicationEngine engine;
+ QStringList selectors;
#ifdef QT_EXTRA_FILE_SELECTOR
- QQmlFileSelector::get(&engine)->setExtraSelectors(QStringList() << QT_EXTRA_FILE_SELECTOR);
+ selectors += QT_EXTRA_FILE_SELECTOR;
+#else
+ if (app.arguments().contains("-touch"))
+ selectors += "touch";
#endif
+
+ QQmlApplicationEngine engine;
+ QQmlFileSelector::get(&engine)->setExtraSelectors(selectors);
+
engine.load(QUrl("qrc:/qml/texteditor.qml"));
if (engine.rootObjects().isEmpty())
return -1;