diff --git a/share/qtcreator/templates/wizards/bb-qt5-quick2app/main.cpp b/share/qtcreator/templates/wizards/bb-qt5-quick2app/main.cpp index 73140fdcc3785d32a9b98c3c742ba73cbbef04b5..bfa891a896e03624f43e2627127bdfc988adc56e 100644 --- a/share/qtcreator/templates/wizards/bb-qt5-quick2app/main.cpp +++ b/share/qtcreator/templates/wizards/bb-qt5-quick2app/main.cpp @@ -1,26 +1,18 @@ -#include <QWindow> -#include <QtDeclarative> +#include <QGuiApplication> #include <QQuickView> +#include <QQmlEngine> int main( int argc, char** argv ) { QGuiApplication app( argc, argv ); - QWindow *window = 0; - int exitCode = 0; + QQuickView view; + view.setResizeMode( QQuickView::SizeRootObjectToView ); + view.setSource( QUrl( "app/native/qml/main.qml" ) ); - QQuickView* view = new QQuickView(); - view->setResizeMode( QQuickView::SizeRootObjectToView ); - view->setSource( QUrl( "app/native/qml/main.qml" ) ); + QObject::connect( view.engine(), SIGNAL( quit() ), + QCoreApplication::instance(), SLOT( quit() ) ); + view.show(); - QDeclarativeEngine* engine = view->engine(); - QObject::connect( engine, SIGNAL(quit()), - QCoreApplication::instance(), SLOT(quit()) ); - window = view; - window->showMaximized(); - - exitCode = app.exec(); - - delete window; - return exitCode; + return app.exec(); }