summaryrefslogtreecommitdiffstats
path: root/examples/quick/controls/shared
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@digia.com>2013-11-27 17:38:12 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-28 16:14:43 +0100
commit1070aeb5521a95039cad3f4536e85e99526a4900 (patch)
tree2b31244780d129053fd30274bc3662be34f45eb4 /examples/quick/controls/shared
parent605f63a1880400a5b540bab60ad68d3612bd71c1 (diff)
Revise main() in examples
Replace the inconvenient QT_QUICK_CONTROLS_EXAMPLE_MAIN macro with a simpler macro that merely defines the actual application type. This way it's easier to do tweaks to main() when for example testing a different application font size. Moreover, browsing the example code becomes more convenient (especially online). Task-number: QTBUG-35083 Change-Id: I8203816a9112bf29b4661baa86bf4a196554db05 Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Diffstat (limited to 'examples/quick/controls/shared')
-rw-r--r--examples/quick/controls/shared/qtquickcontrolsapplication.h (renamed from examples/quick/controls/shared/qt_quick_controls_examplemain.h)29
-rw-r--r--examples/quick/controls/shared/shared.pri4
2 files changed, 9 insertions, 24 deletions
diff --git a/examples/quick/controls/shared/qt_quick_controls_examplemain.h b/examples/quick/controls/shared/qtquickcontrolsapplication.h
index 7f73a6d18..171de6c67 100644
--- a/examples/quick/controls/shared/qt_quick_controls_examplemain.h
+++ b/examples/quick/controls/shared/qtquickcontrolsapplication.h
@@ -39,12 +39,8 @@
**
****************************************************************************/
-#ifndef QT_QUICK_CONTROLS_EXAMPLEMAIN_H
-#define QT_QUICK_CONTROLS_EXAMPLEMAIN_H
-
-#include <QtQml>
-#include <QtQuick/QQuickView>
-#include <QtCore/QString>
+#ifndef QTQUICKCONTROLSAPPLICATION_H
+#define QTQUICKCONTROLSAPPLICATION_H
#ifdef QT_WIDGETS_LIB
#include <QtWidgets/QApplication>
@@ -55,26 +51,11 @@
QT_BEGIN_NAMESPACE
#ifdef QT_WIDGETS_LIB
-#define Application QApplication
+#define QtQuickControlsApplication QApplication
#else
-#define Application QGuiApplication
+#define QtQuickControlsApplication QGuiApplication
#endif
-#define QT_QUICK_CONTROLS_EXAMPLE_MAIN(url) \
- int main(int argc, char *argv[]) \
- { \
- Application app(argc, argv); \
- QQmlApplicationEngine engine(QUrl(#url)); \
- 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(); \
- }
-
QT_END_NAMESPACE
-#endif // QT_QUICK_CONTROLS_EXAMPLEMAIN_H
+#endif // QTQUICKCONTROLSAPPLICATION_H
diff --git a/examples/quick/controls/shared/shared.pri b/examples/quick/controls/shared/shared.pri
new file mode 100644
index 000000000..8ca347371
--- /dev/null
+++ b/examples/quick/controls/shared/shared.pri
@@ -0,0 +1,4 @@
+INCLUDEPATH += $$PWD
+
+SOURCES += \
+ $$PWD/qtquickcontrolsapplication.h