From 9fc3c91388ae6f139813fbf700efc261b430b1d6 Mon Sep 17 00:00:00 2001 From: SineStriker <55847490+SineStriker@users.noreply.github.com> Date: 周一, 11 12月 2023 14:58:06 +0800 Subject: [PATCH] Merge pull request #1 from stdware/qml --- examples/qml/main.qml | 8 ++++++++ examples/qml/CMakeLists.txt | 17 +++++++++++++++++ examples/qml/main.cpp | 18 ++++++++++++++++++ examples/qml/qml.qrc | 5 +++++ examples/CMakeLists.txt | 3 ++- 5 files changed, 50 insertions(+), 1 deletions(-) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index ea64e87..b48fa8b 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,3 +1,4 @@ add_subdirectory(shared) -add_subdirectory(mainwindow) \ No newline at end of file +add_subdirectory(mainwindow) +add_subdirectory(qml) \ No newline at end of file diff --git a/examples/qml/CMakeLists.txt b/examples/qml/CMakeLists.txt new file mode 100644 index 0000000..c638a6a --- /dev/null +++ b/examples/qml/CMakeLists.txt @@ -0,0 +1,17 @@ +project(QWKExample_QML) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTORCC ON) + +file(GLOB _src *.h *.cpp *.qrc) + +add_executable(${PROJECT_NAME}) + +qm_configure_target(${PROJECT_NAME} + SOURCES ${_src} + QT_LINKS Core Gui Qml Quick + LINKS QWKQuick +) + +qm_add_win_manifest(${PROJECT_NAME}) \ No newline at end of file diff --git a/examples/qml/main.cpp b/examples/qml/main.cpp new file mode 100644 index 0000000..4dbda50 --- /dev/null +++ b/examples/qml/main.cpp @@ -0,0 +1,18 @@ +#include <QGuiApplication> +#include <QQmlApplicationEngine> + +int main(int argc, char *argv[]) +{ + qputenv("QT_WIN_DEBUG_CONSOLE", "1"); + qputenv("QSG_INFO", "1"); +#if 1 + qputenv("QSG_RHI_BACKEND", "d3d12"); + qputenv("QSG_RHI_HDR", "scrgb"); + qputenv("QT_QPA_DISABLE_REDIRECTION_SURFACE", "1"); +#endif + QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough); + QGuiApplication application(argc, argv); + QQmlApplicationEngine engine; + engine.load(QUrl(QStringLiteral("qrc:///main.qml"))); + return application.exec(); +} \ No newline at end of file diff --git a/examples/qml/main.qml b/examples/qml/main.qml new file mode 100644 index 0000000..e063bc5 --- /dev/null +++ b/examples/qml/main.qml @@ -0,0 +1,8 @@ +import QtQuick + +Window { + id: window + visible: true + width: 640 + height: 480 +} \ No newline at end of file diff --git a/examples/qml/qml.qrc b/examples/qml/qml.qrc new file mode 100644 index 0000000..dc7d52f --- /dev/null +++ b/examples/qml/qml.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/"> + <file>main.qml</file> + </qresource> +</RCC> \ No newline at end of file -- Gitblit v1.9.1