From 6945a197490e7aa0113bca1f9a13019a27b5d8eb Mon Sep 17 00:00:00 2001
From: Joker <joker2387089590@gmail.com>
Date: 周三, 18 6月 2025 23:10:25 +0800
Subject: [PATCH] change submodule url

---
 examples/qml/main.cpp |   27 +++++++++++++++++++++++----
 1 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/examples/qml/main.cpp b/examples/qml/main.cpp
index 8332f5d..be303df 100644
--- a/examples/qml/main.cpp
+++ b/examples/qml/main.cpp
@@ -4,26 +4,45 @@
 
 #include <QtGui/QGuiApplication>
 #include <QtQml/QQmlApplicationEngine>
+#include <QtQml/QQmlContext>
+#include <QtQuick/QQuickWindow>
 
 #include <QWKQuick/qwkquickglobal.h>
 
+#ifdef Q_OS_WIN
+// Indicates to hybrid graphics systems to prefer the discrete part by default.
+extern "C" {
+    Q_DECL_EXPORT unsigned long NvOptimusEnablement = 0x00000001;
+    Q_DECL_EXPORT int AmdPowerXpressRequestHighPerformance = 1;
+}
+#endif
+
 int main(int argc, char *argv[]) {
-    qputenv("QT_WIN_DEBUG_CONSOLE", "attach");
+    qputenv("QT_WIN_DEBUG_CONSOLE", "attach"); // or "new": create a separate console window
     qputenv("QSG_INFO", "1");
+    qputenv("QSG_NO_VSYNC", "1");
 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
     qputenv("QT_QUICK_CONTROLS_STYLE", "Basic");
 #else
     qputenv("QT_QUICK_CONTROLS_STYLE", "Default");
 #endif
-#if 0
-    qputenv("QSG_RHI_BACKEND", "opengl");
-    //qputenv("QSG_RHI_HDR", "scrgb");
+    //qputenv("QSG_RHI_BACKEND", "opengl"); // other options: d3d11, d3d12, vulkan
+    //qputenv("QSG_RHI_HDR", "scrgb"); // other options: hdr10, p3
     //qputenv("QT_QPA_DISABLE_REDIRECTION_SURFACE", "1");
+#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
     QGuiApplication::setHighDpiScaleFactorRoundingPolicy(
         Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
 #endif
     QGuiApplication application(argc, argv);
+    // Make sure alpha channel is requested, our special effects on Windows depends on it.
+    QQuickWindow::setDefaultAlphaBuffer(true);
     QQmlApplicationEngine engine;
+#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
+    const bool curveRenderingAvailable = true;
+#else
+    const bool curveRenderingAvailable = false;
+#endif
+    engine.rootContext()->setContextProperty(QStringLiteral("$curveRenderingAvailable"), QVariant(curveRenderingAvailable));
     QWK::registerTypes(&engine);
     engine.load(QUrl(QStringLiteral("qrc:///main.qml")));
     return application.exec();

--
Gitblit v1.9.1