mirror of https://github.com/qt/qt3d.git
43 lines
1.1 KiB
C++
43 lines
1.1 KiB
C++
// Copyright (C) 2017 The Qt Company Ltd.
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
|
|
|
|
#include "touchsettings.h"
|
|
#include <QtGui/QGuiApplication>
|
|
#include <QOpenGLContext>
|
|
#include <QtQuick/QQuickView>
|
|
#include <QtQuick/QQuickItem>
|
|
#include <QtQml/QQmlContext>
|
|
|
|
int main(int argc, char* argv[])
|
|
{
|
|
qputenv("QML_XHR_ALLOW_FILE_READ", "1");
|
|
#ifdef Q_OS_ANDROID
|
|
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
#endif
|
|
QGuiApplication app(argc, argv);
|
|
|
|
QSurfaceFormat format;
|
|
if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) {
|
|
format.setVersion(3, 2);
|
|
format.setProfile(QSurfaceFormat::CoreProfile);
|
|
}
|
|
format.setDepthBufferSize(24);
|
|
format.setStencilBufferSize(8);
|
|
|
|
QQuickView view;
|
|
view.setFormat(format);
|
|
view.create();
|
|
|
|
TouchSettings touchSettings;
|
|
view.rootContext()->setContextProperty("touchSettings", &touchSettings);
|
|
|
|
view.setSource(QUrl("qrc:/main.qml"));
|
|
|
|
view.setResizeMode(QQuickView::SizeRootObjectToView);
|
|
view.setMaximumSize(QSize(1820, 1080));
|
|
view.setMinimumSize(QSize(300, 150));
|
|
view.show();
|
|
|
|
return app.exec();
|
|
}
|