diff options
Diffstat (limited to 'examples/quick/controls/texteditor/src/main.cpp')
| -rw-r--r-- | examples/quick/controls/texteditor/src/main.cpp | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/examples/quick/controls/texteditor/src/main.cpp b/examples/quick/controls/texteditor/src/main.cpp index a096f70d1..ea7d22de3 100644 --- a/examples/quick/controls/texteditor/src/main.cpp +++ b/examples/quick/controls/texteditor/src/main.cpp @@ -38,32 +38,14 @@ ** ****************************************************************************/ -#ifdef QT_WIDGETS_LIB -#include <QtWidgets/QApplication> -#else -#include <QtGui/QGuiApplication> -#endif -#include <QtQml> -#include <QtQuick/QQuickView> -#include <QtCore/QString> - +#include "qtquickcontrolsapplication.h" #include "documenthandler.h" +#include <QtQml/QQmlApplicationEngine> int main(int argc, char *argv[]) { -#ifdef QT_WIDGETS_LIB - QApplication app(argc, argv); -#else - QGuiApplication app(argc, argv); -#endif + QtQuickControlsApplication app(argc, argv); qmlRegisterType<DocumentHandler>("org.qtproject.example", 1, 0, "DocumentHandler"); QQmlApplicationEngine engine(QUrl("qrc:/qml/main.qml")); - QObject *topLevel = engine.rootObjects().value(0); - QQuickWindow *window = qobject_cast<QQuickWindow *>(topLevel); - if ( !window ) { - qWarning("Error: Your root item has to be a Window."); - return -1; - } - window->show(); return app.exec(); } |
