qtgraphs/examples/graphs3d/scatter/main.cpp

42 lines
1.1 KiB
C++
Raw Normal View History

2023-03-02 13:45:23 +00:00
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
2023-03-02 13:45:23 +00:00
#include <QtCore/QDir>
#include <QtGui/QGuiApplication>
2023-03-02 13:45:23 +00:00
#include <QtQml/QQmlEngine>
#include <QtQuick/QQuickView>
2023-03-02 13:45:23 +00:00
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QQuickView viewer;
// The following are needed to make examples run without having to install the
// module in desktop environments.
2023-03-02 13:45:23 +00:00
#ifdef Q_OS_WIN
QString extraImportPath(QStringLiteral("%1/../../../../%2"));
#else
QString extraImportPath(QStringLiteral("%1/../../../%2"));
#endif
viewer.engine()->addImportPath(
extraImportPath.arg(QGuiApplication::applicationDirPath(), QString::fromLatin1("qml")));
2023-03-02 13:45:23 +00:00
//! [4]
QObject::connect(viewer.engine(), &QQmlEngine::quit, &viewer, &QWindow::close);
//! [4]
viewer.setTitle(QStringLiteral("Simple Scatter Graph"));
//! [3]
viewer.setSource(QUrl("qrc:/qml/scatter/main.qml"));
2023-03-02 13:45:23 +00:00
//! [3]
viewer.setResizeMode(QQuickView::SizeRootObjectToView);
//! [2]
viewer.showMaximized();
//! [2]
return app.exec();
}