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,43 +1,43 @@
|
|
1
|
-
import QtQuick 2.15
|
2
|
-
|
3
|
-
QtObject {
|
4
|
-
id: root
|
5
|
-
|
6
|
-
// 用法同ButtonGroup
|
7
|
-
property bool exclusive: true
|
8
|
-
property var items: []
|
9
|
-
property Item checkedItem: null
|
10
|
-
readonly property int checkState: {
|
11
|
-
let count = 0;
|
12
|
-
for (let b of items)
|
13
|
-
if (b.checked)
|
14
|
-
count++;
|
15
|
-
return count === 0 ? Qt.Unchecked :
|
16
|
-
count === items.length ? Qt.Checked :
|
17
|
-
Qt.PartiallyChecked;
|
18
|
-
}
|
19
|
-
|
20
|
-
|
21
|
-
// 方法 / functions //
|
22
|
-
function register(button) {
|
23
|
-
if (items.indexOf(button) === -1)
|
24
|
-
items.push(button)
|
25
|
-
}
|
26
|
-
|
27
|
-
function unregister(button) {
|
28
|
-
const idx = items.indexOf(button)
|
29
|
-
if (idx !== -1)
|
30
|
-
items.splice(idx, 1)
|
31
|
-
}
|
32
|
-
|
33
|
-
function updateCheck(button) {
|
34
|
-
if (exclusive) {
|
35
|
-
for (let b of items) {
|
36
|
-
b.checked = (b === button)
|
37
|
-
}
|
38
|
-
checkedItem = button
|
39
|
-
} else {
|
40
|
-
checkedItem = button.checked ? button : null
|
41
|
-
}
|
42
|
-
}
|
43
|
-
}
|
1
|
+
import QtQuick 2.15
|
2
|
+
|
3
|
+
QtObject {
|
4
|
+
id: root
|
5
|
+
|
6
|
+
// 用法同ButtonGroup
|
7
|
+
property bool exclusive: true
|
8
|
+
property var items: []
|
9
|
+
property Item checkedItem: null
|
10
|
+
readonly property int checkState: {
|
11
|
+
let count = 0;
|
12
|
+
for (let b of items)
|
13
|
+
if (b.checked)
|
14
|
+
count++;
|
15
|
+
return count === 0 ? Qt.Unchecked :
|
16
|
+
count === items.length ? Qt.Checked :
|
17
|
+
Qt.PartiallyChecked;
|
18
|
+
}
|
19
|
+
|
20
|
+
|
21
|
+
// 方法 / functions //
|
22
|
+
function register(button) {
|
23
|
+
if (items.indexOf(button) === -1)
|
24
|
+
items.push(button)
|
25
|
+
}
|
26
|
+
|
27
|
+
function unregister(button) {
|
28
|
+
const idx = items.indexOf(button)
|
29
|
+
if (idx !== -1)
|
30
|
+
items.splice(idx, 1)
|
31
|
+
}
|
32
|
+
|
33
|
+
function updateCheck(button) {
|
34
|
+
if (exclusive) {
|
35
|
+
for (let b of items) {
|
36
|
+
b.checked = (b === button)
|
37
|
+
}
|
38
|
+
checkedItem = button
|
39
|
+
} else {
|
40
|
+
checkedItem = button.checked ? button : null
|
41
|
+
}
|
42
|
+
}
|
43
|
+
}
|
@@ -1,14 +1,14 @@
|
|
1
|
-
import QtQuick 2.15
|
2
|
-
import QtQuick.Controls.Basic 2.15
|
3
|
-
import "../../themes"
|
4
|
-
import "../../components"
|
5
|
-
|
6
|
-
|
7
|
-
MenuSeparator {
|
8
|
-
id: root
|
9
|
-
|
10
|
-
contentItem: Rectangle {
|
11
|
-
implicitHeight: 1
|
12
|
-
color: Theme.currentTheme.colors.dividerBorderColor
|
13
|
-
}
|
1
|
+
import QtQuick 2.15
|
2
|
+
import QtQuick.Controls.Basic 2.15
|
3
|
+
import "../../themes"
|
4
|
+
import "../../components"
|
5
|
+
|
6
|
+
|
7
|
+
MenuSeparator {
|
8
|
+
id: root
|
9
|
+
|
10
|
+
contentItem: Rectangle {
|
11
|
+
implicitHeight: 1
|
12
|
+
color: Theme.currentTheme.colors.dividerBorderColor
|
13
|
+
}
|
14
14
|
}
|
@@ -1,38 +1,38 @@
|
|
1
|
-
import QtQuick 2.15
|
2
|
-
import QtQuick.Controls 2.15
|
3
|
-
import "../../themes"
|
4
|
-
import "../../components"
|
5
|
-
|
6
|
-
|
7
|
-
// Menu
|
8
|
-
Menu {
|
9
|
-
id: contextMenu
|
10
|
-
position: -1
|
11
|
-
Action {
|
12
|
-
icon.name: "ic_fluent_cut_20_regular"
|
13
|
-
text: qsTr("Cut")
|
14
|
-
enabled: root.selectedText.length > 0 && root.editable // 选中&可编辑
|
15
|
-
shortcut: "Ctrl+X"
|
16
|
-
onTriggered: root.cut()
|
17
|
-
}
|
18
|
-
Action {
|
19
|
-
icon.name: "ic_fluent_copy_20_regular"
|
20
|
-
text: qsTr("Copy")
|
21
|
-
enabled: root.selectedText.length > 0 // 选中内容
|
22
|
-
shortcut: "Ctrl+C"
|
23
|
-
onTriggered: root.copy()
|
24
|
-
}
|
25
|
-
Action {
|
26
|
-
icon.name: "ic_fluent_clipboard_paste_20_regular"
|
27
|
-
text: qsTr("Paste")
|
28
|
-
enabled: root.editable
|
29
|
-
shortcut: "Ctrl+V"
|
30
|
-
onTriggered: root.paste()
|
31
|
-
}
|
32
|
-
Action {
|
33
|
-
icon.name: " "
|
34
|
-
text: qsTr("Select All")
|
35
|
-
shortcut: "Ctrl+A"
|
36
|
-
onTriggered: root.selectAll()
|
37
|
-
}
|
1
|
+
import QtQuick 2.15
|
2
|
+
import QtQuick.Controls 2.15
|
3
|
+
import "../../themes"
|
4
|
+
import "../../components"
|
5
|
+
|
6
|
+
|
7
|
+
// Menu
|
8
|
+
Menu {
|
9
|
+
id: contextMenu
|
10
|
+
position: -1
|
11
|
+
Action {
|
12
|
+
icon.name: "ic_fluent_cut_20_regular"
|
13
|
+
text: qsTr("Cut")
|
14
|
+
enabled: root.selectedText.length > 0 && root.editable // 选中&可编辑
|
15
|
+
shortcut: "Ctrl+X"
|
16
|
+
onTriggered: root.cut()
|
17
|
+
}
|
18
|
+
Action {
|
19
|
+
icon.name: "ic_fluent_copy_20_regular"
|
20
|
+
text: qsTr("Copy")
|
21
|
+
enabled: root.selectedText.length > 0 // 选中内容
|
22
|
+
shortcut: "Ctrl+C"
|
23
|
+
onTriggered: root.copy()
|
24
|
+
}
|
25
|
+
Action {
|
26
|
+
icon.name: "ic_fluent_clipboard_paste_20_regular"
|
27
|
+
text: qsTr("Paste")
|
28
|
+
enabled: root.editable
|
29
|
+
shortcut: "Ctrl+V"
|
30
|
+
onTriggered: root.paste()
|
31
|
+
}
|
32
|
+
Action {
|
33
|
+
icon.name: " "
|
34
|
+
text: qsTr("Select All")
|
35
|
+
shortcut: "Ctrl+A"
|
36
|
+
onTriggered: root.selectAll()
|
37
|
+
}
|
38
38
|
}
|
@@ -1,17 +1,17 @@
|
|
1
|
-
import QtQuick 2.15
|
2
|
-
import QtQuick.Controls.Basic 2.15
|
3
|
-
import "../../themes"
|
4
|
-
import "../../components"
|
5
|
-
|
6
|
-
|
7
|
-
ToolSeparator {
|
8
|
-
padding: vertical ? 2 : 2
|
9
|
-
topPadding: vertical ? 2 : 2
|
10
|
-
bottomPadding: vertical ? 2 : 2
|
11
|
-
|
12
|
-
contentItem: Rectangle {
|
13
|
-
implicitWidth: parent.vertical ? 1 : 16
|
14
|
-
implicitHeight: parent.vertical ? 16 : 1
|
15
|
-
color: Theme.currentTheme.colors.dividerBorderColor
|
16
|
-
}
|
1
|
+
import QtQuick 2.15
|
2
|
+
import QtQuick.Controls.Basic 2.15
|
3
|
+
import "../../themes"
|
4
|
+
import "../../components"
|
5
|
+
|
6
|
+
|
7
|
+
ToolSeparator {
|
8
|
+
padding: vertical ? 2 : 2
|
9
|
+
topPadding: vertical ? 2 : 2
|
10
|
+
bottomPadding: vertical ? 2 : 2
|
11
|
+
|
12
|
+
contentItem: Rectangle {
|
13
|
+
implicitWidth: parent.vertical ? 1 : 16
|
14
|
+
implicitHeight: parent.vertical ? 16 : 1
|
15
|
+
color: Theme.currentTheme.colors.dividerBorderColor
|
16
|
+
}
|
17
17
|
}
|
@@ -1,48 +1,48 @@
|
|
1
|
-
import QtQuick 2.15
|
2
|
-
import QtQuick.Controls 2.15
|
3
|
-
import QtQuick.Layouts 2.15
|
4
|
-
import RinUI
|
5
|
-
|
6
|
-
FluentPage {
|
7
|
-
id: errorPage
|
8
|
-
|
9
|
-
property string errorMessage: "ERROR_MSG"
|
10
|
-
property string page: "page"
|
11
|
-
|
12
|
-
spacing: 4
|
13
|
-
|
14
|
-
Item {
|
15
|
-
height: 64
|
16
|
-
}
|
17
|
-
|
18
|
-
Text {
|
19
|
-
Layout.alignment: Qt.AlignHCenter
|
20
|
-
typography: Typography.Subtitle
|
21
|
-
text: qsTr("Sorry, something went wrong!")
|
22
|
-
}
|
23
|
-
|
24
|
-
Text {
|
25
|
-
Layout.preferredWidth: parent.width * 0.8
|
26
|
-
Layout.alignment: Qt.AlignHCenter
|
27
|
-
horizontalAlignment: Text.AlignHCenter
|
28
|
-
wrapMode: Text.WordWrap
|
29
|
-
typography: Typography.Body
|
30
|
-
text: page + qsTr(" load failed! \n\n Because of ") + errorMessage + qsTr("\nPlease try again later.")
|
31
|
-
}
|
32
|
-
|
33
|
-
Item {
|
34
|
-
height: 8
|
35
|
-
}
|
36
|
-
|
37
|
-
|
38
|
-
Button {
|
39
|
-
Layout.alignment: Qt.AlignHCenter
|
40
|
-
id: retryButton
|
41
|
-
text: qsTr("Retry")
|
42
|
-
// buttonType: "primary"
|
43
|
-
onClicked: {
|
44
|
-
// 重新加载 Home 页
|
45
|
-
safePush(errorPage.page, true)
|
46
|
-
}
|
47
|
-
}
|
48
|
-
}
|
1
|
+
import QtQuick 2.15
|
2
|
+
import QtQuick.Controls 2.15
|
3
|
+
import QtQuick.Layouts 2.15
|
4
|
+
import RinUI
|
5
|
+
|
6
|
+
FluentPage {
|
7
|
+
id: errorPage
|
8
|
+
|
9
|
+
property string errorMessage: "ERROR_MSG"
|
10
|
+
property string page: "page"
|
11
|
+
|
12
|
+
spacing: 4
|
13
|
+
|
14
|
+
Item {
|
15
|
+
height: 64
|
16
|
+
}
|
17
|
+
|
18
|
+
Text {
|
19
|
+
Layout.alignment: Qt.AlignHCenter
|
20
|
+
typography: Typography.Subtitle
|
21
|
+
text: qsTr("Sorry, something went wrong!")
|
22
|
+
}
|
23
|
+
|
24
|
+
Text {
|
25
|
+
Layout.preferredWidth: parent.width * 0.8
|
26
|
+
Layout.alignment: Qt.AlignHCenter
|
27
|
+
horizontalAlignment: Text.AlignHCenter
|
28
|
+
wrapMode: Text.WordWrap
|
29
|
+
typography: Typography.Body
|
30
|
+
text: page + qsTr(" load failed! \n\n Because of ") + errorMessage + qsTr("\nPlease try again later.")
|
31
|
+
}
|
32
|
+
|
33
|
+
Item {
|
34
|
+
height: 8
|
35
|
+
}
|
36
|
+
|
37
|
+
|
38
|
+
Button {
|
39
|
+
Layout.alignment: Qt.AlignHCenter
|
40
|
+
id: retryButton
|
41
|
+
text: qsTr("Retry")
|
42
|
+
// buttonType: "primary"
|
43
|
+
onClicked: {
|
44
|
+
// 重新加载 Home 页
|
45
|
+
safePush(errorPage.page, true)
|
46
|
+
}
|
47
|
+
}
|
48
|
+
}
|
@@ -1,179 +1,179 @@
|
|
1
|
-
import QtQuick 2.15
|
2
|
-
import QtQuick.Controls 2.15
|
3
|
-
import "../../components"
|
4
|
-
import "../../themes"
|
5
|
-
|
6
|
-
|
7
|
-
Item {
|
8
|
-
id: navigationBar
|
9
|
-
// implicitWidth: collapsed ? 40 : expandWidth
|
10
|
-
height: parent.height
|
11
|
-
|
12
|
-
property bool collapsed: false
|
13
|
-
property var navigationItems: [
|
14
|
-
// {title: "Title", page: "path/to/page.qml", icon: undefined}
|
15
|
-
]
|
16
|
-
|
17
|
-
// property int currentSubIndex: -1
|
18
|
-
property bool titleBarEnabled: true
|
19
|
-
property int expandWidth: 280
|
20
|
-
property int minimumExpandWidth: 900
|
21
|
-
|
22
|
-
property alias windowTitle: titleLabel.text
|
23
|
-
property alias windowIcon: iconLabel.source
|
24
|
-
property int windowWidth: minimumExpandWidth
|
25
|
-
property var stackView: parent.stackView
|
26
|
-
|
27
|
-
property string currentPage: "" // 当前页面的URL
|
28
|
-
property var lastPages: [] // 历史页面的URL栈
|
29
|
-
|
30
|
-
function isNotOverMinimumWidth() { // 判断窗口是否小于最小宽度
|
31
|
-
return windowWidth < minimumExpandWidth;
|
32
|
-
}
|
33
|
-
|
34
|
-
// 展开收缩动画 //
|
35
|
-
width: collapsed ? 40 : expandWidth
|
36
|
-
implicitWidth: isNotOverMinimumWidth() ? 40 : collapsed ? 40 : expandWidth
|
37
|
-
|
38
|
-
Behavior on width {
|
39
|
-
NumberAnimation {
|
40
|
-
duration: Utils.animationSpeed
|
41
|
-
easing.type: Easing.OutQuint
|
42
|
-
}
|
43
|
-
}
|
44
|
-
Behavior on implicitWidth {
|
45
|
-
NumberAnimation {
|
46
|
-
duration: Utils.animationSpeed
|
47
|
-
easing.type: Easing.OutQuint
|
48
|
-
}
|
49
|
-
}
|
50
|
-
|
51
|
-
Rectangle {
|
52
|
-
id: background
|
53
|
-
anchors.fill: parent
|
54
|
-
anchors.margins: -5
|
55
|
-
anchors.topMargin: -title.height
|
56
|
-
radius: Theme.currentTheme.appearance.windowRadius
|
57
|
-
color: Theme.currentTheme.colors.backgroundAcrylicColor
|
58
|
-
border.color: Theme.currentTheme.colors.flyoutBorderColor
|
59
|
-
z: -1
|
60
|
-
visible: isNotOverMinimumWidth() && !collapsed ? 1 : 0
|
61
|
-
|
62
|
-
Behavior on visible {
|
63
|
-
NumberAnimation {
|
64
|
-
duration: collapsed ? Utils.animationSpeed / 2 : 50
|
65
|
-
}
|
66
|
-
}
|
67
|
-
|
68
|
-
layer.enabled: true
|
69
|
-
layer.effect: Shadow {
|
70
|
-
style: "flyout"
|
71
|
-
source: background
|
72
|
-
}
|
73
|
-
}
|
74
|
-
|
75
|
-
Row {
|
76
|
-
id: title
|
77
|
-
anchors.left: parent.left
|
78
|
-
anchors.bottom: parent.top
|
79
|
-
height: titleBarHeight
|
80
|
-
spacing: 16
|
81
|
-
visible: navigationBar.titleBarEnabled
|
82
|
-
|
83
|
-
// 返回按钮
|
84
|
-
ToolButton {
|
85
|
-
flat: true
|
86
|
-
anchors.verticalCenter: parent.verticalCenter
|
87
|
-
icon.name: "ic_fluent_arrow_left_20_regular"
|
88
|
-
onClicked: navigationView.safePop()
|
89
|
-
width: 40
|
90
|
-
height: 40
|
91
|
-
size: 16
|
92
|
-
enabled: lastPages.length > 1
|
93
|
-
|
94
|
-
ToolTip {
|
95
|
-
parent: parent
|
96
|
-
delay: 500
|
97
|
-
visible: parent.hovered
|
98
|
-
text: qsTr("Back")
|
99
|
-
}
|
100
|
-
}
|
101
|
-
|
102
|
-
//图标
|
103
|
-
IconWidget {
|
104
|
-
id: iconLabel
|
105
|
-
size: 16
|
106
|
-
anchors.verticalCenter: parent.verticalCenter
|
107
|
-
}
|
108
|
-
|
109
|
-
//标题
|
110
|
-
Text {
|
111
|
-
id: titleLabel
|
112
|
-
anchors.verticalCenter: parent.verticalCenter
|
113
|
-
|
114
|
-
typography: Typography.Caption
|
115
|
-
// text: title
|
116
|
-
}
|
117
|
-
}
|
118
|
-
|
119
|
-
// 收起切换按钮
|
120
|
-
ToolButton {
|
121
|
-
id: collapseButton
|
122
|
-
flat: true
|
123
|
-
width: 40
|
124
|
-
height: 38
|
125
|
-
// icon.name: collapsed ? "ic_fluent_chevron_right_20_regular" : "ic_fluent_chevron_left_20_regular"
|
126
|
-
icon.name: "ic_fluent_navigation_20_regular"
|
127
|
-
size: 19
|
128
|
-
|
129
|
-
onClicked: {
|
130
|
-
collapsed = !collapsed
|
131
|
-
}
|
132
|
-
|
133
|
-
ToolTip {
|
134
|
-
parent: parent
|
135
|
-
delay: 500
|
136
|
-
visible: parent.hovered && !parent.pressed
|
137
|
-
text: collapsed ? qsTr("Open Navigation") : qsTr("Close Navigation")
|
138
|
-
}
|
139
|
-
}
|
140
|
-
|
141
|
-
Flickable {
|
142
|
-
id: flickable
|
143
|
-
anchors.fill: parent
|
144
|
-
anchors.topMargin: 40
|
145
|
-
contentWidth: parent.width
|
146
|
-
contentHeight: navigationColumn.implicitHeight
|
147
|
-
clip: true
|
148
|
-
|
149
|
-
Column {
|
150
|
-
id: navigationColumn
|
151
|
-
width: flickable.width
|
152
|
-
spacing: 2
|
153
|
-
|
154
|
-
Repeater {
|
155
|
-
model: navigationBar.navigationItems
|
156
|
-
delegate: NavigationItem {
|
157
|
-
id: item
|
158
|
-
itemData: modelData
|
159
|
-
currentPage: navigationBar.stackView
|
160
|
-
|
161
|
-
// 子菜单重置
|
162
|
-
Connections {
|
163
|
-
target: navigationBar
|
164
|
-
function onCollapsedChanged() {
|
165
|
-
if (!navigationBar.collapsed) {
|
166
|
-
return
|
167
|
-
}
|
168
|
-
item.collapsed = navigationBar.collapsed
|
169
|
-
}
|
170
|
-
}
|
171
|
-
}
|
172
|
-
}
|
173
|
-
}
|
174
|
-
|
175
|
-
ScrollBar.vertical: ScrollBar {
|
176
|
-
policy: ScrollBar.AsNeeded
|
177
|
-
}
|
178
|
-
}
|
179
|
-
}
|
1
|
+
import QtQuick 2.15
|
2
|
+
import QtQuick.Controls 2.15
|
3
|
+
import "../../components"
|
4
|
+
import "../../themes"
|
5
|
+
|
6
|
+
|
7
|
+
Item {
|
8
|
+
id: navigationBar
|
9
|
+
// implicitWidth: collapsed ? 40 : expandWidth
|
10
|
+
height: parent.height
|
11
|
+
|
12
|
+
property bool collapsed: false
|
13
|
+
property var navigationItems: [
|
14
|
+
// {title: "Title", page: "path/to/page.qml", icon: undefined}
|
15
|
+
]
|
16
|
+
|
17
|
+
// property int currentSubIndex: -1
|
18
|
+
property bool titleBarEnabled: true
|
19
|
+
property int expandWidth: 280
|
20
|
+
property int minimumExpandWidth: 900
|
21
|
+
|
22
|
+
property alias windowTitle: titleLabel.text
|
23
|
+
property alias windowIcon: iconLabel.source
|
24
|
+
property int windowWidth: minimumExpandWidth
|
25
|
+
property var stackView: parent.stackView
|
26
|
+
|
27
|
+
property string currentPage: "" // 当前页面的URL
|
28
|
+
property var lastPages: [] // 历史页面的URL栈
|
29
|
+
|
30
|
+
function isNotOverMinimumWidth() { // 判断窗口是否小于最小宽度
|
31
|
+
return windowWidth < minimumExpandWidth;
|
32
|
+
}
|
33
|
+
|
34
|
+
// 展开收缩动画 //
|
35
|
+
width: collapsed ? 40 : expandWidth
|
36
|
+
implicitWidth: isNotOverMinimumWidth() ? 40 : collapsed ? 40 : expandWidth
|
37
|
+
|
38
|
+
Behavior on width {
|
39
|
+
NumberAnimation {
|
40
|
+
duration: Utils.animationSpeed
|
41
|
+
easing.type: Easing.OutQuint
|
42
|
+
}
|
43
|
+
}
|
44
|
+
Behavior on implicitWidth {
|
45
|
+
NumberAnimation {
|
46
|
+
duration: Utils.animationSpeed
|
47
|
+
easing.type: Easing.OutQuint
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
Rectangle {
|
52
|
+
id: background
|
53
|
+
anchors.fill: parent
|
54
|
+
anchors.margins: -5
|
55
|
+
anchors.topMargin: -title.height
|
56
|
+
radius: Theme.currentTheme.appearance.windowRadius
|
57
|
+
color: Theme.currentTheme.colors.backgroundAcrylicColor
|
58
|
+
border.color: Theme.currentTheme.colors.flyoutBorderColor
|
59
|
+
z: -1
|
60
|
+
visible: isNotOverMinimumWidth() && !collapsed ? 1 : 0
|
61
|
+
|
62
|
+
Behavior on visible {
|
63
|
+
NumberAnimation {
|
64
|
+
duration: collapsed ? Utils.animationSpeed / 2 : 50
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
layer.enabled: true
|
69
|
+
layer.effect: Shadow {
|
70
|
+
style: "flyout"
|
71
|
+
source: background
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
Row {
|
76
|
+
id: title
|
77
|
+
anchors.left: parent.left
|
78
|
+
anchors.bottom: parent.top
|
79
|
+
height: titleBarHeight
|
80
|
+
spacing: 16
|
81
|
+
visible: navigationBar.titleBarEnabled
|
82
|
+
|
83
|
+
// 返回按钮
|
84
|
+
ToolButton {
|
85
|
+
flat: true
|
86
|
+
anchors.verticalCenter: parent.verticalCenter
|
87
|
+
icon.name: "ic_fluent_arrow_left_20_regular"
|
88
|
+
onClicked: navigationView.safePop()
|
89
|
+
width: 40
|
90
|
+
height: 40
|
91
|
+
size: 16
|
92
|
+
enabled: lastPages.length > 1
|
93
|
+
|
94
|
+
ToolTip {
|
95
|
+
parent: parent
|
96
|
+
delay: 500
|
97
|
+
visible: parent.hovered
|
98
|
+
text: qsTr("Back")
|
99
|
+
}
|
100
|
+
}
|
101
|
+
|
102
|
+
//图标
|
103
|
+
IconWidget {
|
104
|
+
id: iconLabel
|
105
|
+
size: 16
|
106
|
+
anchors.verticalCenter: parent.verticalCenter
|
107
|
+
}
|
108
|
+
|
109
|
+
//标题
|
110
|
+
Text {
|
111
|
+
id: titleLabel
|
112
|
+
anchors.verticalCenter: parent.verticalCenter
|
113
|
+
|
114
|
+
typography: Typography.Caption
|
115
|
+
// text: title
|
116
|
+
}
|
117
|
+
}
|
118
|
+
|
119
|
+
// 收起切换按钮
|
120
|
+
ToolButton {
|
121
|
+
id: collapseButton
|
122
|
+
flat: true
|
123
|
+
width: 40
|
124
|
+
height: 38
|
125
|
+
// icon.name: collapsed ? "ic_fluent_chevron_right_20_regular" : "ic_fluent_chevron_left_20_regular"
|
126
|
+
icon.name: "ic_fluent_navigation_20_regular"
|
127
|
+
size: 19
|
128
|
+
|
129
|
+
onClicked: {
|
130
|
+
collapsed = !collapsed
|
131
|
+
}
|
132
|
+
|
133
|
+
ToolTip {
|
134
|
+
parent: parent
|
135
|
+
delay: 500
|
136
|
+
visible: parent.hovered && !parent.pressed
|
137
|
+
text: collapsed ? qsTr("Open Navigation") : qsTr("Close Navigation")
|
138
|
+
}
|
139
|
+
}
|
140
|
+
|
141
|
+
Flickable {
|
142
|
+
id: flickable
|
143
|
+
anchors.fill: parent
|
144
|
+
anchors.topMargin: 40
|
145
|
+
contentWidth: parent.width
|
146
|
+
contentHeight: navigationColumn.implicitHeight
|
147
|
+
clip: true
|
148
|
+
|
149
|
+
Column {
|
150
|
+
id: navigationColumn
|
151
|
+
width: flickable.width
|
152
|
+
spacing: 2
|
153
|
+
|
154
|
+
Repeater {
|
155
|
+
model: navigationBar.navigationItems
|
156
|
+
delegate: NavigationItem {
|
157
|
+
id: item
|
158
|
+
itemData: modelData
|
159
|
+
currentPage: navigationBar.stackView
|
160
|
+
|
161
|
+
// 子菜单重置
|
162
|
+
Connections {
|
163
|
+
target: navigationBar
|
164
|
+
function onCollapsedChanged() {
|
165
|
+
if (!navigationBar.collapsed) {
|
166
|
+
return
|
167
|
+
}
|
168
|
+
item.collapsed = navigationBar.collapsed
|
169
|
+
}
|
170
|
+
}
|
171
|
+
}
|
172
|
+
}
|
173
|
+
}
|
174
|
+
|
175
|
+
ScrollBar.vertical: ScrollBar {
|
176
|
+
policy: ScrollBar.AsNeeded
|
177
|
+
}
|
178
|
+
}
|
179
|
+
}
|