diff options
Diffstat (limited to 'examples')
21 files changed, 71 insertions, 58 deletions
diff --git a/examples/quick/controls/basiclayouts/basiclayouts.pro b/examples/quick/controls/basiclayouts/basiclayouts.pro index 144ad0fe..a5586fe6 100644 --- a/examples/quick/controls/basiclayouts/basiclayouts.pro +++ b/examples/quick/controls/basiclayouts/basiclayouts.pro @@ -3,6 +3,7 @@ TARGET = basiclayouts !android: !ios: !blackberry: qtHaveModule(widgets): QT += widgets include(src/src.pri) +include(../shared/shared.pri) OTHER_FILES += \ main.qml diff --git a/examples/quick/controls/basiclayouts/main.qml b/examples/quick/controls/basiclayouts/main.qml index fe573aa6..18883d9a 100644 --- a/examples/quick/controls/basiclayouts/main.qml +++ b/examples/quick/controls/basiclayouts/main.qml @@ -47,6 +47,7 @@ import QtQuick.Controls 1.1 import QtQuick.Layouts 1.0 ApplicationWindow { + visible: true title: "Basic layouts" property int margin: 11 width: mainLayout.implicitWidth + 2 * margin diff --git a/examples/quick/controls/basiclayouts/src/main.cpp b/examples/quick/controls/basiclayouts/src/main.cpp index 57ba57e3..a757f485 100644 --- a/examples/quick/controls/basiclayouts/src/main.cpp +++ b/examples/quick/controls/basiclayouts/src/main.cpp @@ -38,5 +38,12 @@ ** ****************************************************************************/ -#include "../../shared/qt_quick_controls_examplemain.h" -QT_QUICK_CONTROLS_EXAMPLE_MAIN(qrc:/main.qml) +#include "qtquickcontrolsapplication.h" +#include <QtQml/QQmlApplicationEngine> + +int main(int argc, char *argv[]) +{ + QtQuickControlsApplication app(argc, argv); + QQmlApplicationEngine engine(QUrl("qrc:/main.qml")); + return app.exec(); +} diff --git a/examples/quick/controls/gallery/content/Styles.qml b/examples/quick/controls/gallery/content/Styles.qml index e774ab52..81b46f63 100644 --- a/examples/quick/controls/gallery/content/Styles.qml +++ b/examples/quick/controls/gallery/content/Styles.qml @@ -309,7 +309,7 @@ Item { anchors.rightMargin: -parent.anchors.rightMargin } } - ParticleSystem{ id: bubbles } + ParticleSystem{ id: bubbles; running: visible } ImageParticle{ id: fireball system: bubbles diff --git a/examples/quick/controls/gallery/gallery.pro b/examples/quick/controls/gallery/gallery.pro index 09358658..68ed0c16 100644 --- a/examples/quick/controls/gallery/gallery.pro +++ b/examples/quick/controls/gallery/gallery.pro @@ -3,6 +3,7 @@ TARGET = gallery !android: !ios: !blackberry: qtHaveModule(widgets): QT += widgets include(src/src.pri) +include(../shared/shared.pri) OTHER_FILES += \ main.qml \ diff --git a/examples/quick/controls/gallery/main.qml b/examples/quick/controls/gallery/main.qml index 43b6776e..61e77ef8 100644 --- a/examples/quick/controls/gallery/main.qml +++ b/examples/quick/controls/gallery/main.qml @@ -49,6 +49,7 @@ import QtQuick.Dialogs 1.0 import "content" ApplicationWindow { + visible: true title: "Component Gallery" width: 640 diff --git a/examples/quick/controls/gallery/src/main.cpp b/examples/quick/controls/gallery/src/main.cpp index 57ba57e3..a757f485 100644 --- a/examples/quick/controls/gallery/src/main.cpp +++ b/examples/quick/controls/gallery/src/main.cpp @@ -38,5 +38,12 @@ ** ****************************************************************************/ -#include "../../shared/qt_quick_controls_examplemain.h" -QT_QUICK_CONTROLS_EXAMPLE_MAIN(qrc:/main.qml) +#include "qtquickcontrolsapplication.h" +#include <QtQml/QQmlApplicationEngine> + +int main(int argc, char *argv[]) +{ + QtQuickControlsApplication app(argc, argv); + QQmlApplicationEngine engine(QUrl("qrc:/main.qml")); + return app.exec(); +} diff --git a/examples/quick/controls/shared/qt_quick_controls_examplemain.h b/examples/quick/controls/shared/qtquickcontrolsapplication.h index 7f73a6d1..171de6c6 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 00000000..8ca34737 --- /dev/null +++ b/examples/quick/controls/shared/shared.pri @@ -0,0 +1,4 @@ +INCLUDEPATH += $$PWD + +SOURCES += \ + $$PWD/qtquickcontrolsapplication.h diff --git a/examples/quick/controls/splitview/main.qml b/examples/quick/controls/splitview/main.qml index 992607d6..395188ce 100644 --- a/examples/quick/controls/splitview/main.qml +++ b/examples/quick/controls/splitview/main.qml @@ -47,6 +47,7 @@ import QtQuick.Controls 1.1 import QtQuick.Layouts 1.0 ApplicationWindow { + visible: true width: 600 height: 400 diff --git a/examples/quick/controls/splitview/splitview.pro b/examples/quick/controls/splitview/splitview.pro index 066e578c..11c55f74 100644 --- a/examples/quick/controls/splitview/splitview.pro +++ b/examples/quick/controls/splitview/splitview.pro @@ -3,6 +3,7 @@ TARGET = splitview !android: !ios: !blackberry: qtHaveModule(widgets): QT += widgets include(src/src.pri) +include(../shared/shared.pri) OTHER_FILES += \ main.qml diff --git a/examples/quick/controls/splitview/src/main.cpp b/examples/quick/controls/splitview/src/main.cpp index 57ba57e3..a757f485 100644 --- a/examples/quick/controls/splitview/src/main.cpp +++ b/examples/quick/controls/splitview/src/main.cpp @@ -38,5 +38,12 @@ ** ****************************************************************************/ -#include "../../shared/qt_quick_controls_examplemain.h" -QT_QUICK_CONTROLS_EXAMPLE_MAIN(qrc:/main.qml) +#include "qtquickcontrolsapplication.h" +#include <QtQml/QQmlApplicationEngine> + +int main(int argc, char *argv[]) +{ + QtQuickControlsApplication app(argc, argv); + QQmlApplicationEngine engine(QUrl("qrc:/main.qml")); + return app.exec(); +} diff --git a/examples/quick/controls/tableview/main.qml b/examples/quick/controls/tableview/main.qml index 37ab383e..d15b6f65 100644 --- a/examples/quick/controls/tableview/main.qml +++ b/examples/quick/controls/tableview/main.qml @@ -48,7 +48,7 @@ import QtQuick.Controls 1.1 import QtQuick.XmlListModel 2.0 Window { - + visible: true width: 538 + frame.margins * 2 height: 360 + frame.margins * 2 @@ -385,7 +385,7 @@ Window { CheckBox{ id: sortableCheckbox checked: false - text: "Sortindicator" + text: "Sort indicator" anchors.verticalCenter: parent.verticalCenter } CheckBox{ diff --git a/examples/quick/controls/tableview/src/main.cpp b/examples/quick/controls/tableview/src/main.cpp index 57ba57e3..a757f485 100644 --- a/examples/quick/controls/tableview/src/main.cpp +++ b/examples/quick/controls/tableview/src/main.cpp @@ -38,5 +38,12 @@ ** ****************************************************************************/ -#include "../../shared/qt_quick_controls_examplemain.h" -QT_QUICK_CONTROLS_EXAMPLE_MAIN(qrc:/main.qml) +#include "qtquickcontrolsapplication.h" +#include <QtQml/QQmlApplicationEngine> + +int main(int argc, char *argv[]) +{ + QtQuickControlsApplication app(argc, argv); + QQmlApplicationEngine engine(QUrl("qrc:/main.qml")); + return app.exec(); +} diff --git a/examples/quick/controls/tableview/tableview.pro b/examples/quick/controls/tableview/tableview.pro index f3d7d7e6..7238d007 100644 --- a/examples/quick/controls/tableview/tableview.pro +++ b/examples/quick/controls/tableview/tableview.pro @@ -3,6 +3,7 @@ TARGET = tableview !android: !ios: !blackberry: qtHaveModule(widgets): QT += widgets include(src/src.pri) +include(../shared/shared.pri) OTHER_FILES += \ main.qml diff --git a/examples/quick/controls/texteditor/qml/main.qml b/examples/quick/controls/texteditor/qml/main.qml index 50cbed56..89120094 100644 --- a/examples/quick/controls/texteditor/qml/main.qml +++ b/examples/quick/controls/texteditor/qml/main.qml @@ -46,6 +46,7 @@ import QtQuick.Window 2.1 import org.qtproject.example 1.0 ApplicationWindow { + visible: true width: 640 height: 480 minimumWidth: 400 diff --git a/examples/quick/controls/texteditor/src/main.cpp b/examples/quick/controls/texteditor/src/main.cpp index a096f70d..ea7d22de 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(); } diff --git a/examples/quick/controls/texteditor/texteditor.pro b/examples/quick/controls/texteditor/texteditor.pro index d9b6c8a3..06e669d9 100644 --- a/examples/quick/controls/texteditor/texteditor.pro +++ b/examples/quick/controls/texteditor/texteditor.pro @@ -3,6 +3,7 @@ TARGET = texteditor !android: !ios: !blackberry: qtHaveModule(widgets): QT += widgets include(src/src.pri) +include(../shared/shared.pri) OTHER_FILES += \ qml/main.qml \ diff --git a/examples/quick/controls/touch/main.qml b/examples/quick/controls/touch/main.qml index a6de8910..ab5d534f 100644 --- a/examples/quick/controls/touch/main.qml +++ b/examples/quick/controls/touch/main.qml @@ -43,6 +43,7 @@ import QtQuick.Controls 1.1 import "content" ApplicationWindow { + visible: true width: 800 height: 1280 diff --git a/examples/quick/controls/touch/src/main.cpp b/examples/quick/controls/touch/src/main.cpp index 57ba57e3..a757f485 100644 --- a/examples/quick/controls/touch/src/main.cpp +++ b/examples/quick/controls/touch/src/main.cpp @@ -38,5 +38,12 @@ ** ****************************************************************************/ -#include "../../shared/qt_quick_controls_examplemain.h" -QT_QUICK_CONTROLS_EXAMPLE_MAIN(qrc:/main.qml) +#include "qtquickcontrolsapplication.h" +#include <QtQml/QQmlApplicationEngine> + +int main(int argc, char *argv[]) +{ + QtQuickControlsApplication app(argc, argv); + QQmlApplicationEngine engine(QUrl("qrc:/main.qml")); + return app.exec(); +} diff --git a/examples/quick/controls/touch/touch.pro b/examples/quick/controls/touch/touch.pro index 1e5d12f3..6afca140 100644 --- a/examples/quick/controls/touch/touch.pro +++ b/examples/quick/controls/touch/touch.pro @@ -3,6 +3,7 @@ TARGET = touch !android: !ios: !blackberry: qtHaveModule(widgets): QT += widgets include(src/src.pri) +include(../shared/shared.pri) OTHER_FILES += \ main.qml \ |