diff options
author | Kai Koehne <kai.koehne@qt.io> | 2018-11-19 15:59:55 +0100 |
---|---|---|
committer | Kai Koehne <kai.koehne@qt.io> | 2019-01-24 11:00:51 +0000 |
commit | cc1a7a75ec5d2222230e90a6afb8770dc5810ed6 (patch) | |
tree | a423964c0bfa0cd6867e363eeaf3dafbf79952ef /examples/demos/clocks | |
parent | 09f7f933740458585fc389fd03f11ab5f8302f79 (diff) |
Make examples self-contained
Remove shared main entry function and shared resources (that were not
used anyway), and simplify the entry point:
* Get rid of special handling of QT_QUICK_CORE_PROFILE,
QT_QUICK_MULTISAMPLE environment variables.
* Remove QQmlFileSelector, which is not used in the examples.
* Do set QtCoreAppication::organizationName to 'QtExamples', so that the
settings are separate from QtProject. This follows recent changes in
Qt WebEngine examples.
Change-Id: I01851b3434901fefc2738136a2f1795d682a3233
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'examples/demos/clocks')
-rw-r--r-- | examples/demos/clocks/main.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/examples/demos/clocks/main.cpp b/examples/demos/clocks/main.cpp index c2508dc6a..5889eabad 100644 --- a/examples/demos/clocks/main.cpp +++ b/examples/demos/clocks/main.cpp @@ -47,5 +47,25 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "../shared/shared.h" -DECLARATIVE_EXAMPLE_MAIN(demos/clocks/clocks) + +#include <QGuiApplication> +#include <QQmlEngine> +#include <QQmlFileSelector> +#include <QQuickView> + +int main(int argc, char *argv[]) +{ + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + QCoreApplication::setOrganizationName("QtExamples"); + + QGuiApplication app(argc, argv); + + QQuickView view; + view.connect(view.engine(), &QQmlEngine::quit, &app, &QCoreApplication::quit); + view.setSource(QUrl("qrc:/demos/clocks/clocks.qml")); + if (view.status() == QQuickView::Error) + return -1; + view.setResizeMode(QQuickView::SizeRootObjectToView); + view.show(); + return app.exec(); +} |