aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick/scenegraph/customrendernode/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/quick/scenegraph/customrendernode/main.cpp')
-rw-r--r--examples/quick/scenegraph/customrendernode/main.cpp28
1 files changed, 16 insertions, 12 deletions
diff --git a/examples/quick/scenegraph/customrendernode/main.cpp b/examples/quick/scenegraph/customrendernode/main.cpp
index 5cc870b1aa..0ad93ec1de 100644
--- a/examples/quick/scenegraph/customrendernode/main.cpp
+++ b/examples/quick/scenegraph/customrendernode/main.cpp
@@ -1,12 +1,15 @@
// Copyright (C) 2022 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QGuiApplication>
-#include <QtQuick/QQuickView>
+#include <QQuickView>
#include <QSurfaceFormat>
int main(int argc, char **argv)
{
+ QGuiApplication app(argc, argv);
+
+ // On macOS, request a core profile context in the unlikely case of using OpenGL.
#ifdef Q_OS_MACOS
QSurfaceFormat format = QSurfaceFormat::defaultFormat();
format.setMajorVersion(4);
@@ -15,30 +18,31 @@ int main(int argc, char **argv)
QSurfaceFormat::setDefaultFormat(format);
#endif
- QGuiApplication app(argc, argv);
-
QQuickView view;
view.setResizeMode(QQuickView::SizeRootObjectToView);
view.setSource(QUrl("qrc:///scenegraph/customrendernode/main.qml"));
- view.setColor(QColor(0, 0, 0));
+ view.setColor(Qt::black);
view.show();
QString api;
switch (view.graphicsApi()) {
- case QSGRendererInterface::GraphicsApi::OpenGLRhi:
+ case QSGRendererInterface::OpenGL:
api = "RHI OpenGL";
break;
- case QSGRendererInterface::GraphicsApi::Direct3D11Rhi:
- api = "RHI Direct3D";
+ case QSGRendererInterface::Direct3D11:
+ api = "RHI Direct 3D 11";
+ break;
+ case QSGRendererInterface::Direct3D12:
+ api = "RHI Direct 3D 12";
break;
- case QSGRendererInterface::GraphicsApi::VulkanRhi:
+ case QSGRendererInterface::Vulkan:
api = "RHI Vulkan";
break;
- case QSGRendererInterface::GraphicsApi::MetalRhi:
+ case QSGRendererInterface::Metal:
api = "RHI Metal";
break;
- case QSGRendererInterface::GraphicsApi::NullRhi:
+ case QSGRendererInterface::Null:
api = "RHI Null";
break;
default:
@@ -48,5 +52,5 @@ int main(int argc, char **argv)
view.setTitle(QStringLiteral("Custom QSGRenderNode - ") + api);
- return QGuiApplication::exec();
+ return app.exec();
}