Yuhang Zhao
2023-12-11 e9ce49b601b412050e9709a3474e51950dccd5a9
add empty qml demo
1个文件已修改
4个文件已添加
49 ■■■■■ 已修改文件
examples/CMakeLists.txt 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
examples/qml/CMakeLists.txt 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
examples/qml/main.cpp 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
examples/qml/main.qml 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
examples/qml/qml.qrc 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
examples/CMakeLists.txt
@@ -1,3 +1,4 @@
add_subdirectory(shared)
add_subdirectory(mainwindow)
add_subdirectory(qml)
examples/qml/CMakeLists.txt
New file
@@ -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})
examples/qml/main.cpp
New file
@@ -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();
}
examples/qml/main.qml
New file
@@ -0,0 +1,8 @@
import QtQuick
Window {
    id: window
    visible: true
    width: 640
    height: 480
}
examples/qml/qml.qrc
New file
@@ -0,0 +1,5 @@
<RCC>
    <qresource prefix="/">
        <file>main.qml</file>
    </qresource>
</RCC>