From a9c357c40d29e9a7ea59ffa80214657ef58c7dbe Mon Sep 17 00:00:00 2001
From: Zhao Yuhang <2546789017@qq.com>
Date: 周一, 27 5月 2024 23:18:42 +0800
Subject: [PATCH] Fix typo

---
 examples/qml/main.qml |   96 +++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 94 insertions(+), 2 deletions(-)

diff --git a/examples/qml/main.qml b/examples/qml/main.qml
index b266921..e27239c 100644
--- a/examples/qml/main.qml
+++ b/examples/qml/main.qml
@@ -1,17 +1,27 @@
 import QtQuick 2.15
 import QtQuick.Window 2.15
 import QtQuick.Controls 2.15
+import Qt.labs.platform 1.1
 import QWindowKit 1.0
 
 Window {
     id: window
     width: 800
     height: 600
-    color: "#1E1E1E"
+    color: darkStyle.windowBackgroundColor
     title: qsTr("Hello, world!")
     Component.onCompleted: {
         windowAgent.setup(window)
         window.visible = true
+    }
+
+    QtObject {
+        id: lightStyle
+    }
+
+    QtObject {
+        id: darkStyle
+        readonly property color windowBackgroundColor: "#1E1E1E"
     }
 
     Timer {
@@ -25,11 +35,16 @@
         id: windowAgent
     }
 
+    MouseArea {
+        anchors.fill: parent
+        acceptedButtons: Qt.RightButton
+        onClicked: contextMenu.open()
+    }
+
     Rectangle {
         id: titleBar
         anchors {
             top: parent.top
-            topMargin: 1
             left: parent.left
             right: parent.right
         }
@@ -48,6 +63,7 @@
             height: 18
             mipmap: true
             source: "qrc:///app/example.png"
+            Component.onCompleted: windowAgent.setSystemButton(WindowAgent.WindowIcon, iconButton)
         }
 
         Text {
@@ -125,4 +141,80 @@
         }
         color: "#FEFEFE"
     }
+
+    Menu {
+        id: contextMenu
+
+        Menu {
+            id: themeMenu
+            title: qsTr("Theme")
+
+            MenuItemGroup {
+                id: themeMenuGroup
+                items: themeMenu.items
+            }
+
+            MenuItem {
+                text: qsTr("Light")
+                checkable: true
+                onTriggered: windowAgent.setWindowAttribute("dark-mode", false)
+            }
+
+            MenuItem {
+                text: qsTr("Dark")
+                checkable: true
+                onTriggered: windowAgent.setWindowAttribute("dark-mode", true)
+            }
+        }
+
+        Menu {
+            id: specialEffectMenu
+            title: qsTr("Special effect")
+
+            MenuItemGroup {
+                id: specialEffectMenuGroup
+                items: specialEffectMenu.items
+            }
+
+            MenuItem {
+                enabled: Qt.platform.os === "windows"
+                text: qsTr("DWM blur")
+                checkable: true
+                onTriggered: {
+                    window.color = checked ? "transparent" : darkStyle.windowBackgroundColor
+                    windowAgent.setWindowAttribute("dwm-blur", checked)
+                }
+            }
+
+            MenuItem {
+                enabled: Qt.platform.os === "windows"
+                text: qsTr("Acrylic material")
+                checkable: true
+                onTriggered: {
+                    window.color = checked ? "transparent" : darkStyle.windowBackgroundColor
+                    windowAgent.setWindowAttribute("acrylic-material", checked)
+                }
+            }
+
+            MenuItem {
+                enabled: Qt.platform.os === "windows"
+                text: qsTr("Mica")
+                checkable: true
+                onTriggered: {
+                    window.color = checked ? "transparent" : darkStyle.windowBackgroundColor
+                    windowAgent.setWindowAttribute("mica", checked)
+                }
+            }
+
+            MenuItem {
+                enabled: Qt.platform.os === "windows"
+                text: qsTr("Mica Alt")
+                checkable: true
+                onTriggered: {
+                    window.color = checked ? "transparent" : darkStyle.windowBackgroundColor
+                    windowAgent.setWindowAttribute("mica-alt", checked)
+                }
+            }
+        }
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.1