aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quickcontrols2/texteditor/texteditor.cpp
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2016-07-26 14:15:31 +0200
committerMitch Curtis <mitch.curtis@qt.io>2016-08-24 08:09:24 +0000
commita80f50ab9bba8f6f9d19d1edb2eeafce9dcee799 (patch)
treea0af6c8bdc1837e01fc3cd0cedd60077d03d2006 /examples/quickcontrols2/texteditor/texteditor.cpp
parent0524ddb9489cd9816fadc330f75efc7b40994013 (diff)
texteditor: add touch UI
Task-number: QTBUG-54952 Change-Id: I14fe95608c4393b928edc80fc93ebaa843ce478f Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'examples/quickcontrols2/texteditor/texteditor.cpp')
-rw-r--r--examples/quickcontrols2/texteditor/texteditor.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/examples/quickcontrols2/texteditor/texteditor.cpp b/examples/quickcontrols2/texteditor/texteditor.cpp
index 9af4cc3b..7fda4fa9 100644
--- a/examples/quickcontrols2/texteditor/texteditor.cpp
+++ b/examples/quickcontrols2/texteditor/texteditor.cpp
@@ -38,13 +38,17 @@
**
****************************************************************************/
+#ifdef QT_WIDGETS_LIB
#include <QApplication>
+#else
+#include <QGuiApplication>
+#endif
#include <QFontDatabase>
#include <QDebug>
#include <QQmlApplicationEngine>
#include <QQmlContext>
+#include <QQmlFileSelector>
#include <QQuickStyle>
-#include <QFileSelector>
#include "documenthandler.h"
@@ -54,7 +58,11 @@ int main(int argc, char *argv[])
QGuiApplication::setOrganizationName("QtProject");
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
+#ifdef QT_WIDGETS_LIB
QApplication app(argc, argv);
+#else
+ QGuiApplication app(argc, argv);
+#endif
QFontDatabase fontDatabase;
if (fontDatabase.addApplicationFont(":/fonts/fontello.ttf") == -1)
@@ -63,6 +71,9 @@ int main(int argc, char *argv[])
qmlRegisterType<DocumentHandler>("io.qt.examples.texteditor", 1, 0, "DocumentHandler");
QQmlApplicationEngine engine;
+#ifdef QT_EXTRA_FILE_SELECTOR
+ QQmlFileSelector::get(&engine)->setExtraSelectors(QStringList() << QT_EXTRA_FILE_SELECTOR);
+#endif
engine.load(QUrl("qrc:/qml/texteditor.qml"));
if (engine.rootObjects().isEmpty())
return -1;