RinUI 0.1.0__py3-none-any.whl → 0.1.1.post1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. RinUI/__init__.py +4 -4
  2. RinUI/assets/fonts/FluentSystemIcons-Index.js +5255 -5255
  3. RinUI/components/Base.qml +78 -78
  4. RinUI/components/BasicInput/Button.qml +146 -146
  5. RinUI/components/BasicInput/CheckBox.qml +98 -98
  6. RinUI/components/BasicInput/ComboBox.qml +159 -159
  7. RinUI/components/BasicInput/DropDownButton.qml +20 -20
  8. RinUI/components/BasicInput/Hyperlink.qml +17 -17
  9. RinUI/components/BasicInput/PillButton.qml +10 -10
  10. RinUI/components/BasicInput/RadioButton.qml +94 -94
  11. RinUI/components/BasicInput/RoundButton.qml +26 -26
  12. RinUI/components/BasicInput/Slider.qml +212 -212
  13. RinUI/components/BasicInput/Switch.qml +101 -101
  14. RinUI/components/BasicInput/ToggleButton.qml +10 -10
  15. RinUI/components/BasicInput/ToolButton.qml +30 -30
  16. RinUI/components/ContextMenu.qml +183 -183
  17. RinUI/components/DateAndTime/DatePicker.qml +142 -140
  18. RinUI/components/DateAndTime/PickerView.qml +223 -223
  19. RinUI/components/DateAndTime/TimePicker.qml +114 -114
  20. RinUI/components/DialogsAndFlyouts/Dialog.qml +106 -106
  21. RinUI/components/DialogsAndFlyouts/DialogButtonBox.qml +47 -47
  22. RinUI/components/DialogsAndFlyouts/Flyout.qml +87 -87
  23. RinUI/components/DialogsAndFlyouts/Popup.qml +110 -106
  24. RinUI/components/FocusIndicator.qml +33 -33
  25. RinUI/components/IconWidget.qml +52 -52
  26. RinUI/components/Indicator.qml +89 -89
  27. RinUI/components/Layout/Expander.qml +159 -159
  28. RinUI/components/Layout/SettingExpander.qml +66 -66
  29. RinUI/components/Layout/SettingItem.qml +70 -70
  30. RinUI/components/ListAndCollections/Clip.qml +21 -21
  31. RinUI/components/ListAndCollections/Frame.qml +43 -43
  32. RinUI/components/ListAndCollections/ListView.qml +104 -104
  33. RinUI/components/ListAndCollections/ListViewDelegate.qml +82 -82
  34. RinUI/components/ListAndCollections/SettingCard.qml +72 -72
  35. RinUI/components/ListAndCollections/TableView.qml +81 -81
  36. RinUI/components/ListAndCollections/TableViewDelegate.qml +88 -88
  37. RinUI/components/Media/Avatar.qml +82 -82
  38. RinUI/components/MenusAndToolbars/Menu.qml +150 -150
  39. RinUI/components/MenusAndToolbars/MenuBar.qml +42 -42
  40. RinUI/components/MenusAndToolbars/MenuItem.qml +131 -131
  41. RinUI/components/MenusAndToolbars/MenuItemGroup.qml +43 -43
  42. RinUI/components/MenusAndToolbars/MenuSeparator.qml +13 -13
  43. RinUI/components/MenusAndToolbars/TextInputMenu.qml +37 -37
  44. RinUI/components/MenusAndToolbars/ToolSeparator.qml +16 -16
  45. RinUI/components/Navigation/ErrorPage.qml +48 -48
  46. RinUI/components/Navigation/NavigationBar.qml +179 -179
  47. RinUI/components/Navigation/NavigationItem.qml +193 -193
  48. RinUI/components/Navigation/NavigationSubItem.qml +103 -103
  49. RinUI/components/Navigation/NavigationView.qml +228 -227
  50. RinUI/components/Navigation/Segmented.qml +16 -16
  51. RinUI/components/Navigation/SegmentedItem.qml +107 -107
  52. RinUI/components/Navigation/SelectorBar.qml +12 -12
  53. RinUI/components/Navigation/SelectorBarItem.qml +88 -88
  54. RinUI/components/ScrollBar.qml +204 -204
  55. RinUI/components/ScrollView.qml +12 -12
  56. RinUI/components/Shadow.qml +47 -47
  57. RinUI/components/StatusAndInfo/InfoBadge.qml +77 -77
  58. RinUI/components/StatusAndInfo/InfoBar.qml +256 -251
  59. RinUI/components/StatusAndInfo/ProgressBar.qml +126 -126
  60. RinUI/components/StatusAndInfo/ProgressRing.qml +149 -0
  61. RinUI/components/StatusAndInfo/Toast.qml +236 -236
  62. RinUI/components/StatusAndInfo/ToolTip.qml +93 -93
  63. RinUI/components/Text/SpinBox.qml +150 -133
  64. RinUI/components/Text/Text.qml +44 -44
  65. RinUI/components/Text/TextArea.qml +117 -117
  66. RinUI/components/Text/TextField.qml +113 -113
  67. RinUI/components/Text/TextInput.qml +47 -47
  68. RinUI/components/qmldir +80 -80
  69. RinUI/core/__init__.py +4 -4
  70. RinUI/core/config.py +129 -129
  71. RinUI/core/launcher.py +129 -129
  72. RinUI/core/theme.py +339 -339
  73. RinUI/core/translator.py +26 -25
  74. RinUI/hooks/__init__.py +3 -3
  75. RinUI/hooks/hook-RinUI.py +3 -3
  76. RinUI/qmldir +108 -104
  77. RinUI/themes/Appearance.qml +36 -0
  78. RinUI/themes/Colors.qml +36 -0
  79. RinUI/themes/dark.qml +145 -145
  80. RinUI/themes/light.qml +145 -145
  81. RinUI/themes/qmldir +9 -6
  82. RinUI/themes/theme.qml +151 -149
  83. RinUI/themes/utils.qml +37 -37
  84. RinUI/utils/Animation.qml +12 -12
  85. RinUI/utils/FloatLayer.qml +132 -123
  86. RinUI/utils/FontIconLoader.qml +13 -13
  87. RinUI/utils/Position.qml +19 -19
  88. RinUI/utils/Severity.qml +13 -13
  89. RinUI/utils/Typography.qml +17 -17
  90. RinUI/utils/qmldir +4 -4
  91. RinUI/windows/CtrlBtn.qml +118 -118
  92. RinUI/windows/FluentPage.qml +92 -92
  93. RinUI/windows/FluentWindow.qml +31 -30
  94. RinUI/windows/FluentWindowBase.qml +158 -158
  95. RinUI/windows/TitleBar.qml +135 -135
  96. RinUI/windows/qmldir +7 -7
  97. RinUI/windows/window/ApplicationWindow.qml +8 -8
  98. RinUI/windows/window/Window.qml +118 -118
  99. {rinui-0.1.0.data → rinui-0.1.1.post1.data}/data/LICENSE +21 -21
  100. {rinui-0.1.0.data → rinui-0.1.1.post1.data}/data/README.md +100 -100
  101. {rinui-0.1.0.dist-info → rinui-0.1.1.post1.dist-info}/METADATA +116 -115
  102. rinui-0.1.1.post1.dist-info/RECORD +112 -0
  103. {rinui-0.1.0.dist-info → rinui-0.1.1.post1.dist-info}/WHEEL +1 -1
  104. {rinui-0.1.0.dist-info → rinui-0.1.1.post1.dist-info/licenses}/LICENSE +21 -21
  105. RinUI/__pycache__/__init__.cpython-38.pyc +0 -0
  106. RinUI/config/rin_ui.json +0 -8
  107. RinUI/core/__pycache__/__init__.cpython-38.pyc +0 -0
  108. RinUI/core/__pycache__/config.cpython-38.pyc +0 -0
  109. RinUI/core/__pycache__/launcher.cpython-38.pyc +0 -0
  110. RinUI/core/__pycache__/theme.cpython-38.pyc +0 -0
  111. RinUI/core/__pycache__/translator.cpython-38.pyc +0 -0
  112. rinui-0.1.0.dist-info/RECORD +0 -116
  113. {rinui-0.1.0.dist-info → rinui-0.1.1.post1.dist-info}/entry_points.txt +0 -0
  114. {rinui-0.1.0.dist-info → rinui-0.1.1.post1.dist-info}/top_level.txt +0 -0
@@ -1,158 +1,158 @@
1
- import QtQuick 2.15
2
- import QtQuick.Controls 2.15
3
- import QtQuick.Layouts 2.15
4
- import "../themes"
5
- import "../windows"
6
- import "../components"
7
-
8
- ApplicationWindow {
9
- id: baseWindow
10
- // visible: true
11
- width: 800
12
- height: 600
13
- minimumWidth: 400
14
- minimumHeight: 300
15
- property int hwnd: 0
16
-
17
- flags: frameless ? Qt.FramelessWindowHint | Qt.Window | Qt.WindowMinimizeButtonHint | Qt.WindowMaximizeButtonHint | Qt.WindowCloseButtonHint :
18
- Qt.Window
19
- color: frameless ? "transparent" : Theme.currentTheme.colors.backgroundColor
20
-
21
- // 自定义属性
22
- property var icon: "../assets/img/default_app_icon.png" // 图标
23
- property alias titleEnabled: titleBar.titleEnabled
24
- property int titleBarHeight: Theme.currentTheme.appearance.dialogTitleBarHeight
25
- property bool frameless: true // 是否无边框
26
-
27
-
28
- // 直接添加子项
29
- property alias framelessMenuBar: menuBarArea.children // 无边框模式时菜单栏
30
- default property alias content: contentArea.children
31
- property alias floatLayer: floatLayer
32
-
33
- // 最大化样式
34
- onVisibilityChanged: {
35
- if (baseWindow.visibility === Window.Maximized) {
36
- background.radius = 0
37
- background.border.width = 0
38
- } else {
39
- background.radius = Theme.currentTheme.appearance.windowRadius
40
- background.border.width = 1
41
- }
42
- }
43
-
44
- // 布局
45
- ColumnLayout {
46
- anchors.fill: parent
47
- // anchors.topMargin: Utils.windowDragArea
48
- anchors.bottomMargin: Utils.windowDragArea
49
- anchors.leftMargin: Utils.windowDragArea
50
- anchors.rightMargin: Utils.windowDragArea
51
- spacing: 0
52
-
53
- // 顶部边距
54
- Item {
55
- Layout.preferredHeight: frameless ? titleBar.height : 0
56
- Layout.fillWidth: true
57
- }
58
-
59
- // menubar
60
- Item {
61
- id: menuBarArea
62
- Layout.fillWidth: true
63
- }
64
-
65
- // 主体内容区域
66
- Item {
67
- id: contentArea
68
- Layout.fillWidth: true
69
- Layout.fillHeight: true
70
- }
71
- }
72
-
73
- // 标题栏
74
- TitleBar {
75
- id: titleBar
76
- window: baseWindow
77
- icon: baseWindow.icon
78
- title: baseWindow.title
79
- Layout.fillWidth: true
80
- height: baseWindow.titleBarHeight
81
- visible: frameless
82
- }
83
-
84
-
85
- // 背景样式
86
- background: Rectangle {
87
- id: background
88
- anchors.fill: parent
89
- color: Utils.backdropEnabled ? "transparent" : Theme.currentTheme.colors.backgroundColor
90
- border.color: Theme.currentTheme.colors.windowBorderColor
91
- layer.enabled: true // 启用透明渲染
92
- border.width: 1
93
- radius: Theme.currentTheme.appearance.windowRadius
94
- z: -1
95
- clip: true
96
- visible: frameless
97
-
98
- // Shadow {}
99
-
100
- Behavior on color {
101
- ColorAnimation {
102
- duration: Utils.backdropEnabled ? 0 : 150
103
- }
104
- }
105
- }
106
-
107
- Behavior on color {
108
- ColorAnimation {
109
- duration: Utils.appearanceSpeed
110
- }
111
- }
112
-
113
- FloatLayer {
114
- id: floatLayer
115
- anchors.topMargin: titleBarHeight
116
- z: 998
117
- }
118
-
119
-
120
- //改变鼠标形状
121
- MouseArea {
122
- anchors.fill: parent
123
- hoverEnabled: baseWindow.visibility !== Window.Maximized
124
- z: -1
125
- cursorShape: {
126
- if (!baseWindow.frameless) {
127
- return
128
- }
129
- const p = Qt.point(mouseX, mouseY)
130
- const b = Utils.windowDragArea
131
- if (p.x < b && p.y < b) return Qt.SizeFDiagCursor
132
- if (p.x >= width - b && p.y >= height - b) return Qt.SizeFDiagCursor
133
- if (p.x >= width - b && p.y < b) return Qt.SizeBDiagCursor
134
- if (p.x < b && p.y >= height - b) return Qt.SizeBDiagCursor
135
- if (p.x < b || p.x >= width - b) return Qt.SizeHorCursor
136
- if (p.y < b || p.y >= height - b) return Qt.SizeVerCursor
137
- }
138
- acceptedButtons: Qt.NoButton
139
- }
140
-
141
- DragHandler {
142
- id: resizeHandler
143
- grabPermissions: TapHandler.TakeOverForbidden
144
- target: null
145
- onActiveChanged: if (active && baseWindow.visibility !== Window.Maximized) {
146
- const p = resizeHandler.centroid.position
147
- const b = Utils.windowDragArea + 10
148
- let e = 0;
149
- if (p.x < b) e |= Qt.LeftEdge
150
- if (p.x >= width - b) e |= Qt.RightEdge
151
- if (p.y < b) e |= Qt.TopEdge
152
- if (p.y >= height - b) e |= Qt.BottomEdge
153
- if (e !== 0) {
154
- baseWindow.startSystemResize(e)
155
- }
156
- }
157
- }
158
- }
1
+ import QtQuick 2.15
2
+ import QtQuick.Controls 2.15
3
+ import QtQuick.Layouts 2.15
4
+ import "../themes"
5
+ import "../windows"
6
+ import "../components"
7
+
8
+ ApplicationWindow {
9
+ id: baseWindow
10
+ // visible: true
11
+ width: 800
12
+ height: 600
13
+ minimumWidth: 400
14
+ minimumHeight: 300
15
+ property int hwnd: 0
16
+
17
+ flags: frameless ? Qt.FramelessWindowHint | Qt.Window | Qt.WindowMinimizeButtonHint | Qt.WindowMaximizeButtonHint | Qt.WindowCloseButtonHint :
18
+ Qt.Window
19
+ color: frameless ? "transparent" : Theme.currentTheme.colors.backgroundColor
20
+
21
+ // 自定义属性
22
+ property var icon: "../assets/img/default_app_icon.png" // 图标
23
+ property alias titleEnabled: titleBar.titleEnabled
24
+ property int titleBarHeight: Theme.currentTheme.appearance.dialogTitleBarHeight
25
+ property bool frameless: true // 是否无边框
26
+
27
+
28
+ // 直接添加子项
29
+ property alias framelessMenuBar: menuBarArea.children // 无边框模式时菜单栏
30
+ default property alias content: contentArea.children
31
+ property alias floatLayer: floatLayer
32
+
33
+ // 最大化样式
34
+ onVisibilityChanged: {
35
+ if (baseWindow.visibility === Window.Maximized) {
36
+ background.radius = 0
37
+ background.border.width = 0
38
+ } else {
39
+ background.radius = Theme.currentTheme.appearance.windowRadius
40
+ background.border.width = 1
41
+ }
42
+ }
43
+
44
+ // 布局
45
+ ColumnLayout {
46
+ anchors.fill: parent
47
+ // anchors.topMargin: Utils.windowDragArea
48
+ anchors.bottomMargin: Utils.windowDragArea
49
+ anchors.leftMargin: Utils.windowDragArea
50
+ anchors.rightMargin: Utils.windowDragArea
51
+ spacing: 0
52
+
53
+ // 顶部边距
54
+ Item {
55
+ Layout.preferredHeight: frameless ? titleBar.height : 0
56
+ Layout.fillWidth: true
57
+ }
58
+
59
+ // menubar
60
+ Item {
61
+ id: menuBarArea
62
+ Layout.fillWidth: true
63
+ }
64
+
65
+ // 主体内容区域
66
+ Item {
67
+ id: contentArea
68
+ Layout.fillWidth: true
69
+ Layout.fillHeight: true
70
+ }
71
+ }
72
+
73
+ // 标题栏
74
+ TitleBar {
75
+ id: titleBar
76
+ window: baseWindow
77
+ icon: baseWindow.icon
78
+ title: baseWindow.title
79
+ Layout.fillWidth: true
80
+ height: baseWindow.titleBarHeight
81
+ visible: frameless
82
+ }
83
+
84
+
85
+ // 背景样式
86
+ background: Rectangle {
87
+ id: background
88
+ anchors.fill: parent
89
+ color: Utils.backdropEnabled ? "transparent" : Theme.currentTheme.colors.backgroundColor
90
+ border.color: Theme.currentTheme.colors.windowBorderColor
91
+ layer.enabled: true // 启用透明渲染
92
+ border.width: 1
93
+ radius: Theme.currentTheme.appearance.windowRadius
94
+ z: -1
95
+ clip: true
96
+ visible: frameless
97
+
98
+ // Shadow {}
99
+
100
+ Behavior on color {
101
+ ColorAnimation {
102
+ duration: Utils.backdropEnabled ? 0 : 150
103
+ }
104
+ }
105
+ }
106
+
107
+ Behavior on color {
108
+ ColorAnimation {
109
+ duration: Utils.appearanceSpeed
110
+ }
111
+ }
112
+
113
+ FloatLayer {
114
+ id: floatLayer
115
+ anchors.topMargin: titleBarHeight
116
+ z: 998
117
+ }
118
+
119
+
120
+ //改变鼠标形状
121
+ MouseArea {
122
+ anchors.fill: parent
123
+ hoverEnabled: baseWindow.visibility !== Window.Maximized
124
+ z: -1
125
+ cursorShape: {
126
+ if (!baseWindow.frameless) {
127
+ return
128
+ }
129
+ const p = Qt.point(mouseX, mouseY)
130
+ const b = Utils.windowDragArea
131
+ if (p.x < b && p.y < b) return Qt.SizeFDiagCursor
132
+ if (p.x >= width - b && p.y >= height - b) return Qt.SizeFDiagCursor
133
+ if (p.x >= width - b && p.y < b) return Qt.SizeBDiagCursor
134
+ if (p.x < b && p.y >= height - b) return Qt.SizeBDiagCursor
135
+ if (p.x < b || p.x >= width - b) return Qt.SizeHorCursor
136
+ if (p.y < b || p.y >= height - b) return Qt.SizeVerCursor
137
+ }
138
+ acceptedButtons: Qt.NoButton
139
+ }
140
+
141
+ DragHandler {
142
+ id: resizeHandler
143
+ grabPermissions: TapHandler.TakeOverForbidden
144
+ target: null
145
+ onActiveChanged: if (active && baseWindow.visibility !== Window.Maximized) {
146
+ const p = resizeHandler.centroid.position
147
+ const b = Utils.windowDragArea + 10
148
+ let e = 0;
149
+ if (p.x < b) e |= Qt.LeftEdge
150
+ if (p.x >= width - b) e |= Qt.RightEdge
151
+ if (p.y < b) e |= Qt.TopEdge
152
+ if (p.y >= height - b) e |= Qt.BottomEdge
153
+ if (e !== 0) {
154
+ baseWindow.startSystemResize(e)
155
+ }
156
+ }
157
+ }
158
+ }
@@ -1,136 +1,136 @@
1
- import QtQuick 2.12
2
- import QtQuick.Controls 2.3
3
- import QtQuick.Window 2.3
4
- import "../themes"
5
- import "../components"
6
- import "../windows"
7
-
8
- Item {
9
- id: root
10
- property int titleBarHeight: Theme.currentTheme.appearance.dialogTitleBarHeight
11
- property alias title: titleLabel.text
12
- property alias icon: iconLabel.source
13
- property alias backgroundColor: rectBk.color
14
-
15
- // 自定义属性
16
- property bool titleEnabled: true
17
- property alias iconEnabled: iconLabel.visible
18
- property bool minimizeEnabled: true
19
- property bool maximizeEnabled: true
20
- property bool closeEnabled: true
21
-
22
- property alias minimizeVisible: minimizeBtn.visible
23
- property alias maximizeVisible: maximizeBtn.visible
24
- property alias closeVisible: closeBtn.visible
25
-
26
-
27
- height: titleBarHeight
28
- anchors.top: parent.top
29
- anchors.left: parent.left
30
- anchors.right: parent.right
31
- clip: true
32
- z: 999
33
-
34
- implicitWidth: 200
35
-
36
- property var window: null
37
- function toggleMaximized() {
38
- if (window.visibility === Window.Maximized) {
39
- window.showNormal();
40
- } else {
41
- window.showMaximized();
42
- }
43
- }
44
-
45
- Rectangle{
46
- id:rectBk
47
- anchors.fill: parent
48
- color: "transparent"
49
-
50
- MouseArea {
51
- anchors.fill: parent
52
- anchors.leftMargin: 48
53
- anchors.margins: Utils.windowDragArea
54
- propagateComposedEvents: true
55
- acceptedButtons: Qt.LeftButton
56
- property point clickPos: "0,0"
57
-
58
- onPressed: {
59
- clickPos = Qt.point(mouseX, mouseY)
60
-
61
- if (!(Qt.platform.os !== "windows" || Qt.platform.os !== "winrt") && !Theme._isThemeMgrInitialized()) {
62
- return // 在win环境使用原生方法拖拽
63
- }
64
- Theme.sendDragWindowEvent(window)
65
- }
66
- onDoubleClicked: toggleMaximized()
67
- onPositionChanged: (mouse) => {
68
- if (window.isMaximized || window.isFullScreen || window.visibility === Window.Maximized) {
69
- return
70
- }
71
-
72
- if ((Qt.platform.os !== "windows" || Qt.platform.os !== "winrt") && Theme._isThemeMgrInitialized()) {
73
- return // 在win环境使用原生方法拖拽
74
- }
75
-
76
- //鼠标偏移量
77
- let delta = Qt.point(mouse.x-clickPos.x, mouse.y-clickPos.y)
78
-
79
- window.setX(window.x+delta.x)
80
- window.setY(window.y+delta.y)
81
- }
82
- }
83
- }
84
-
85
- // 窗口按钮 / Window Controls
86
- Row{
87
- anchors.right: parent.right
88
- anchors.top: parent.top
89
- anchors.bottom: parent.bottom
90
- spacing: 0
91
- CtrlBtn {
92
- id: minimizeBtn
93
- mode: 1
94
- enabled: root.minimizeEnabled
95
- }
96
- CtrlBtn {
97
- id: maximizeBtn
98
- mode: 0
99
- enabled: root.maximizeEnabled
100
-
101
- }
102
- CtrlBtn {
103
- id: closeBtn
104
- mode: 2
105
- enabled: root.closeEnabled
106
- }
107
- }
108
-
109
- // 窗口标题 / Window Title
110
- Row {
111
- id: titleRow
112
- anchors.left: parent.left
113
- anchors.top: parent.top
114
- anchors.bottom: parent.bottom
115
- anchors.leftMargin: 16
116
- spacing: 16
117
- visible: root.titleEnabled
118
-
119
- //图标
120
- IconWidget {
121
- id: iconLabel
122
- size: 16
123
- anchors.verticalCenter: parent.verticalCenter
124
- visible: icon || source
125
- }
126
-
127
- //标题
128
- Text {
129
- id: titleLabel
130
- anchors.verticalCenter: parent.verticalCenter
131
-
132
- typography: Typography.Caption
133
- text: qsTr("Fluent TitleBar")
134
- }
135
- }
1
+ import QtQuick 2.12
2
+ import QtQuick.Controls 2.3
3
+ import QtQuick.Window 2.3
4
+ import "../themes"
5
+ import "../components"
6
+ import "../windows"
7
+
8
+ Item {
9
+ id: root
10
+ property int titleBarHeight: Theme.currentTheme.appearance.dialogTitleBarHeight
11
+ property alias title: titleLabel.text
12
+ property alias icon: iconLabel.source
13
+ property alias backgroundColor: rectBk.color
14
+
15
+ // 自定义属性
16
+ property bool titleEnabled: true
17
+ property alias iconEnabled: iconLabel.visible
18
+ property bool minimizeEnabled: true
19
+ property bool maximizeEnabled: true
20
+ property bool closeEnabled: true
21
+
22
+ property alias minimizeVisible: minimizeBtn.visible
23
+ property alias maximizeVisible: maximizeBtn.visible
24
+ property alias closeVisible: closeBtn.visible
25
+
26
+
27
+ height: titleBarHeight
28
+ anchors.top: parent.top
29
+ anchors.left: parent.left
30
+ anchors.right: parent.right
31
+ clip: true
32
+ z: 999
33
+
34
+ implicitWidth: 200
35
+
36
+ property var window: null
37
+ function toggleMaximized() {
38
+ if (window.visibility === Window.Maximized) {
39
+ window.showNormal();
40
+ } else {
41
+ window.showMaximized();
42
+ }
43
+ }
44
+
45
+ Rectangle{
46
+ id:rectBk
47
+ anchors.fill: parent
48
+ color: "transparent"
49
+
50
+ MouseArea {
51
+ anchors.fill: parent
52
+ anchors.leftMargin: 48
53
+ anchors.margins: Utils.windowDragArea
54
+ propagateComposedEvents: true
55
+ acceptedButtons: Qt.LeftButton
56
+ property point clickPos: "0,0"
57
+
58
+ onPressed: {
59
+ clickPos = Qt.point(mouseX, mouseY)
60
+
61
+ if (!(Qt.platform.os !== "windows" || Qt.platform.os !== "winrt") && !Theme._isThemeMgrInitialized()) {
62
+ return // 在win环境使用原生方法拖拽
63
+ }
64
+ Theme.sendDragWindowEvent(window)
65
+ }
66
+ onDoubleClicked: toggleMaximized()
67
+ onPositionChanged: (mouse) => {
68
+ if (window.isMaximized || window.isFullScreen || window.visibility === Window.Maximized) {
69
+ return
70
+ }
71
+
72
+ if ((Qt.platform.os !== "windows" || Qt.platform.os !== "winrt") && Theme._isThemeMgrInitialized()) {
73
+ return // 在win环境使用原生方法拖拽
74
+ }
75
+
76
+ //鼠标偏移量
77
+ let delta = Qt.point(mouse.x-clickPos.x, mouse.y-clickPos.y)
78
+
79
+ window.setX(window.x+delta.x)
80
+ window.setY(window.y+delta.y)
81
+ }
82
+ }
83
+ }
84
+
85
+ // 窗口按钮 / Window Controls
86
+ Row{
87
+ anchors.right: parent.right
88
+ anchors.top: parent.top
89
+ anchors.bottom: parent.bottom
90
+ spacing: 0
91
+ CtrlBtn {
92
+ id: minimizeBtn
93
+ mode: 1
94
+ enabled: root.minimizeEnabled
95
+ }
96
+ CtrlBtn {
97
+ id: maximizeBtn
98
+ mode: 0
99
+ enabled: root.maximizeEnabled
100
+
101
+ }
102
+ CtrlBtn {
103
+ id: closeBtn
104
+ mode: 2
105
+ enabled: root.closeEnabled
106
+ }
107
+ }
108
+
109
+ // 窗口标题 / Window Title
110
+ Row {
111
+ id: titleRow
112
+ anchors.left: parent.left
113
+ anchors.top: parent.top
114
+ anchors.bottom: parent.bottom
115
+ anchors.leftMargin: 16
116
+ spacing: 16
117
+ visible: root.titleEnabled
118
+
119
+ //图标
120
+ IconWidget {
121
+ id: iconLabel
122
+ size: 16
123
+ anchors.verticalCenter: parent.verticalCenter
124
+ visible: icon || source
125
+ }
126
+
127
+ //标题
128
+ Text {
129
+ id: titleLabel
130
+ anchors.verticalCenter: parent.verticalCenter
131
+
132
+ typography: Typography.Caption
133
+ text: qsTr("Fluent TitleBar")
134
+ }
135
+ }
136
136
  }
RinUI/windows/qmldir CHANGED
@@ -1,8 +1,8 @@
1
- module RinUI.windows
2
-
3
- FluentWindowBase 1.0 FluentWindowBase.qml
4
- FluentWindow 1.0 FluentWindow.qml
5
- TitleBar 1.0 TitleBar.qml
6
- FluentPage 1.0 FluentPage.qml
7
- CtrlBtn 1.0 CtrlBtn.qml
1
+ module RinUI.windows
2
+
3
+ FluentWindowBase 1.0 FluentWindowBase.qml
4
+ FluentWindow 1.0 FluentWindow.qml
5
+ TitleBar 1.0 TitleBar.qml
6
+ FluentPage 1.0 FluentPage.qml
7
+ CtrlBtn 1.0 CtrlBtn.qml
8
8
  ErrorPage 1.0 ErrorPage.qml
@@ -1,9 +1,9 @@
1
- import QtQuick 2.15
2
- import QtQuick.Controls 2.15
3
- import "../../windows"
4
-
5
- FluentWindowBase {
6
- id: baseWindow
7
- frameless: false
8
- default property alias content: baseWindow.content
1
+ import QtQuick 2.15
2
+ import QtQuick.Controls 2.15
3
+ import "../../windows"
4
+
5
+ FluentWindowBase {
6
+ id: baseWindow
7
+ frameless: false
8
+ default property alias content: baseWindow.content
9
9
  }