From cc65c4da6ad762e8648b2ab6a801e07c50922d3d Mon Sep 17 00:00:00 2001 From: Zhao Yuhang <2546789017@qq.com> Date: 周二, 04 2月 2025 21:58:21 +0800 Subject: [PATCH] fix compilation error --- examples/qml/main.qml | 57 +++++++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 45 insertions(+), 12 deletions(-) diff --git a/examples/qml/main.qml b/examples/qml/main.qml index 8c59b9e..d9ba183 100644 --- a/examples/qml/main.qml +++ b/examples/qml/main.qml @@ -12,6 +12,7 @@ title: qsTr("Hello, world!") Component.onCompleted: { windowAgent.setup(window) + windowAgent.setWindowAttribute("dark-mode", true) window.visible = true } @@ -35,17 +36,15 @@ id: windowAgent } - MouseArea { - anchors.fill: parent + TapHandler { acceptedButtons: Qt.RightButton - onClicked: contextMenu.open() + onTapped: contextMenu.open() } Rectangle { id: titleBar anchors { top: parent.top - topMargin: 1 left: parent.left right: parent.right } @@ -64,6 +63,8 @@ height: 18 mipmap: true source: "qrc:///app/example.png" + fillMode: Image.PreserveAspectFit + Component.onCompleted: windowAgent.setSystemButton(WindowAgent.WindowIcon, iconButton) } Text { @@ -140,6 +141,11 @@ bold: true } color: "#FEFEFE" + Component.onCompleted: { + if ($curveRenderingAvailable) { + timeLabel.renderType = Text.CurveRendering + } + } } Menu { @@ -163,6 +169,7 @@ MenuItem { text: qsTr("Dark") checkable: true + checked: true onTriggered: windowAgent.setWindowAttribute("dark-mode", true) } } @@ -178,11 +185,28 @@ MenuItem { enabled: Qt.platform.os === "windows" + text: qsTr("None") + checkable: true + checked: true + onTriggered: { + window.color = darkStyle.windowBackgroundColor + windowAgent.setWindowAttribute("dwm-blur", false) + windowAgent.setWindowAttribute("acrylic-material", false) + windowAgent.setWindowAttribute("mica", false) + windowAgent.setWindowAttribute("mica-alt", false) + } + } + + MenuItem { + enabled: Qt.platform.os === "windows" text: qsTr("DWM blur") checkable: true onTriggered: { - window.color = checked ? "transparent" : darkStyle.windowBackgroundColor - windowAgent.setWindowAttribute("dwm-blur", checked) + window.color = "transparent" + windowAgent.setWindowAttribute("acrylic-material", false) + windowAgent.setWindowAttribute("mica", false) + windowAgent.setWindowAttribute("mica-alt", false) + windowAgent.setWindowAttribute("dwm-blur", true) } } @@ -191,8 +215,11 @@ text: qsTr("Acrylic material") checkable: true onTriggered: { - window.color = checked ? "transparent" : darkStyle.windowBackgroundColor - windowAgent.setWindowAttribute("acrylic-material", checked) + window.color = "transparent" + windowAgent.setWindowAttribute("dwm-blur", false) + windowAgent.setWindowAttribute("mica", false) + windowAgent.setWindowAttribute("mica-alt", false) + windowAgent.setWindowAttribute("acrylic-material", true) } } @@ -201,8 +228,11 @@ text: qsTr("Mica") checkable: true onTriggered: { - window.color = checked ? "transparent" : darkStyle.windowBackgroundColor - windowAgent.setWindowAttribute("mica", checked) + window.color = "transparent" + windowAgent.setWindowAttribute("dwm-blur", false) + windowAgent.setWindowAttribute("acrylic-material", false) + windowAgent.setWindowAttribute("mica-alt", false) + windowAgent.setWindowAttribute("mica", true) } } @@ -211,8 +241,11 @@ text: qsTr("Mica Alt") checkable: true onTriggered: { - window.color = checked ? "transparent" : darkStyle.windowBackgroundColor - windowAgent.setWindowAttribute("mica-alt", checked) + window.color = "transparent" + windowAgent.setWindowAttribute("dwm-blur", false) + windowAgent.setWindowAttribute("acrylic-material", false) + windowAgent.setWindowAttribute("mica", false) + windowAgent.setWindowAttribute("mica-alt", true) } } } -- Gitblit v1.9.1