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.
- RinUI/__init__.py +4 -4
- RinUI/assets/fonts/FluentSystemIcons-Index.js +5255 -5255
- RinUI/components/Base.qml +78 -78
- RinUI/components/BasicInput/Button.qml +146 -146
- RinUI/components/BasicInput/CheckBox.qml +98 -98
- RinUI/components/BasicInput/ComboBox.qml +159 -159
- RinUI/components/BasicInput/DropDownButton.qml +20 -20
- RinUI/components/BasicInput/Hyperlink.qml +17 -17
- RinUI/components/BasicInput/PillButton.qml +10 -10
- RinUI/components/BasicInput/RadioButton.qml +94 -94
- RinUI/components/BasicInput/RoundButton.qml +26 -26
- RinUI/components/BasicInput/Slider.qml +212 -212
- RinUI/components/BasicInput/Switch.qml +101 -101
- RinUI/components/BasicInput/ToggleButton.qml +10 -10
- RinUI/components/BasicInput/ToolButton.qml +30 -30
- RinUI/components/ContextMenu.qml +183 -183
- RinUI/components/DateAndTime/DatePicker.qml +142 -140
- RinUI/components/DateAndTime/PickerView.qml +223 -223
- RinUI/components/DateAndTime/TimePicker.qml +114 -114
- RinUI/components/DialogsAndFlyouts/Dialog.qml +106 -106
- RinUI/components/DialogsAndFlyouts/DialogButtonBox.qml +47 -47
- RinUI/components/DialogsAndFlyouts/Flyout.qml +87 -87
- RinUI/components/DialogsAndFlyouts/Popup.qml +110 -106
- RinUI/components/FocusIndicator.qml +33 -33
- RinUI/components/IconWidget.qml +52 -52
- RinUI/components/Indicator.qml +89 -89
- RinUI/components/Layout/Expander.qml +159 -159
- RinUI/components/Layout/SettingExpander.qml +66 -66
- RinUI/components/Layout/SettingItem.qml +70 -70
- RinUI/components/ListAndCollections/Clip.qml +21 -21
- RinUI/components/ListAndCollections/Frame.qml +43 -43
- RinUI/components/ListAndCollections/ListView.qml +104 -104
- RinUI/components/ListAndCollections/ListViewDelegate.qml +82 -82
- RinUI/components/ListAndCollections/SettingCard.qml +72 -72
- RinUI/components/ListAndCollections/TableView.qml +81 -81
- RinUI/components/ListAndCollections/TableViewDelegate.qml +88 -88
- RinUI/components/Media/Avatar.qml +82 -82
- RinUI/components/MenusAndToolbars/Menu.qml +150 -150
- RinUI/components/MenusAndToolbars/MenuBar.qml +42 -42
- RinUI/components/MenusAndToolbars/MenuItem.qml +131 -131
- RinUI/components/MenusAndToolbars/MenuItemGroup.qml +43 -43
- RinUI/components/MenusAndToolbars/MenuSeparator.qml +13 -13
- RinUI/components/MenusAndToolbars/TextInputMenu.qml +37 -37
- RinUI/components/MenusAndToolbars/ToolSeparator.qml +16 -16
- RinUI/components/Navigation/ErrorPage.qml +48 -48
- RinUI/components/Navigation/NavigationBar.qml +179 -179
- RinUI/components/Navigation/NavigationItem.qml +193 -193
- RinUI/components/Navigation/NavigationSubItem.qml +103 -103
- RinUI/components/Navigation/NavigationView.qml +228 -227
- RinUI/components/Navigation/Segmented.qml +16 -16
- RinUI/components/Navigation/SegmentedItem.qml +107 -107
- RinUI/components/Navigation/SelectorBar.qml +12 -12
- RinUI/components/Navigation/SelectorBarItem.qml +88 -88
- RinUI/components/ScrollBar.qml +204 -204
- RinUI/components/ScrollView.qml +12 -12
- RinUI/components/Shadow.qml +47 -47
- RinUI/components/StatusAndInfo/InfoBadge.qml +77 -77
- RinUI/components/StatusAndInfo/InfoBar.qml +256 -251
- RinUI/components/StatusAndInfo/ProgressBar.qml +126 -126
- RinUI/components/StatusAndInfo/ProgressRing.qml +149 -0
- RinUI/components/StatusAndInfo/Toast.qml +236 -236
- RinUI/components/StatusAndInfo/ToolTip.qml +93 -93
- RinUI/components/Text/SpinBox.qml +150 -133
- RinUI/components/Text/Text.qml +44 -44
- RinUI/components/Text/TextArea.qml +117 -117
- RinUI/components/Text/TextField.qml +113 -113
- RinUI/components/Text/TextInput.qml +47 -47
- RinUI/components/qmldir +80 -80
- RinUI/core/__init__.py +4 -4
- RinUI/core/config.py +129 -129
- RinUI/core/launcher.py +129 -129
- RinUI/core/theme.py +339 -339
- RinUI/core/translator.py +26 -25
- RinUI/hooks/__init__.py +3 -3
- RinUI/hooks/hook-RinUI.py +3 -3
- RinUI/qmldir +108 -104
- RinUI/themes/Appearance.qml +36 -0
- RinUI/themes/Colors.qml +36 -0
- RinUI/themes/dark.qml +145 -145
- RinUI/themes/light.qml +145 -145
- RinUI/themes/qmldir +9 -6
- RinUI/themes/theme.qml +151 -149
- RinUI/themes/utils.qml +37 -37
- RinUI/utils/Animation.qml +12 -12
- RinUI/utils/FloatLayer.qml +132 -123
- RinUI/utils/FontIconLoader.qml +13 -13
- RinUI/utils/Position.qml +19 -19
- RinUI/utils/Severity.qml +13 -13
- RinUI/utils/Typography.qml +17 -17
- RinUI/utils/qmldir +4 -4
- RinUI/windows/CtrlBtn.qml +118 -118
- RinUI/windows/FluentPage.qml +92 -92
- RinUI/windows/FluentWindow.qml +31 -30
- RinUI/windows/FluentWindowBase.qml +158 -158
- RinUI/windows/TitleBar.qml +135 -135
- RinUI/windows/qmldir +7 -7
- RinUI/windows/window/ApplicationWindow.qml +8 -8
- RinUI/windows/window/Window.qml +118 -118
- {rinui-0.1.0.data → rinui-0.1.1.post1.data}/data/LICENSE +21 -21
- {rinui-0.1.0.data → rinui-0.1.1.post1.data}/data/README.md +100 -100
- {rinui-0.1.0.dist-info → rinui-0.1.1.post1.dist-info}/METADATA +116 -115
- rinui-0.1.1.post1.dist-info/RECORD +112 -0
- {rinui-0.1.0.dist-info → rinui-0.1.1.post1.dist-info}/WHEEL +1 -1
- {rinui-0.1.0.dist-info → rinui-0.1.1.post1.dist-info/licenses}/LICENSE +21 -21
- RinUI/__pycache__/__init__.cpython-38.pyc +0 -0
- RinUI/config/rin_ui.json +0 -8
- RinUI/core/__pycache__/__init__.cpython-38.pyc +0 -0
- RinUI/core/__pycache__/config.cpython-38.pyc +0 -0
- RinUI/core/__pycache__/launcher.cpython-38.pyc +0 -0
- RinUI/core/__pycache__/theme.cpython-38.pyc +0 -0
- RinUI/core/__pycache__/translator.cpython-38.pyc +0 -0
- rinui-0.1.0.dist-info/RECORD +0 -116
- {rinui-0.1.0.dist-info → rinui-0.1.1.post1.dist-info}/entry_points.txt +0 -0
- {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
|
+
}
|
RinUI/windows/TitleBar.qml
CHANGED
@@ -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
|
}
|