Qt 5.10 Book Examples
main.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // main.cpp
3 // ======================================================================
4 // This file is a part of the book
5 // "Qt 5.10 Professional programming with C++"
6 // http://qt-book.com
7 // ======================================================================
8 // Copyright (c) 2017 by Max Schlee
9 // ======================================================================
10 
11 #include <QGuiApplication>
12 #include <QQmlEngine>
13 #include <QQmlFileSelector>
14 #include <QQuickView>
15 #include <QDir>
16 
17 // ----------------------------------------------------------------------
18 int main(int argc, char** argv)
19 {
20  QGuiApplication app(argc,argv);
21  QQuickView view;
22  QFileInfo fi(app.applicationFilePath());
23 
24  app.setApplicationName(fi.baseName());
25 
26  view.connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit()));
27 
28  /*QQmlFileSelector* ps =*/ new QQmlFileSelector(view.engine(), &view);
29 
30  view.setSource(QUrl("qrc:/main.qml"));
31  view.setResizeMode(QQuickView::SizeRootObjectToView);
32  view.show();
33 
34  return app.exec();
35 }
int main(int argc, char **argv)
Definition: main.cpp:15