Debian Codegraph @

tests/manual/qmlchartproperties/main.cpp

raw
1 // Copyright (C) 2016 The Qt Company Ltd.
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4 #include <QtWidgets/QApplication>
5 #include <QtCore/QDir>
6 #include <QtQuick/QQuickView>
7 #include <QtQml/QQmlEngine>
8
9 int main(int argc, char *argv[])
10 {
11 // Qt Charts uses Qt Graphics View Framework for drawing, therefore QApplication must be used.
12 QApplication app(argc, argv);
13
14 QQuickView viewer;
15
16 // The following are needed to make examples run without having to install the module
17 // in desktop environments.
18 #ifdef Q_OS_WIN
19 QString extraImportPath(QStringLiteral("%1/../../../../%2"));
20 #else
21 QString extraImportPath(QStringLiteral("%1/../../../%2"));
22 #endif
23 viewer.engine()->addImportPath(extraImportPath.arg(QGuiApplication::applicationDirPath(),
24 QString::fromLatin1("qml")));
25 QObject::connect(viewer.engine(), &QQmlEngine::quit, &viewer, &QWindow::close);
26
27 viewer.setSource(QUrl("qrc:/qml/qmlchartproperties/main.qml"));
28 viewer.setResizeMode(QQuickView::SizeRootObjectToView);
29 viewer.show();
30
31 return app.exec();
32 }