RinUI 0.0.9__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 (102) hide show
  1. RinUI/__init__.py +4 -0
  2. RinUI/__pycache__/__init__.cpython-38.pyc +0 -0
  3. RinUI/assets/fonts/FluentSystemIcons-Index.js +5256 -0
  4. RinUI/assets/fonts/FluentSystemIcons-Resizable.ttf +0 -0
  5. RinUI/assets/img/default_app_icon.png +0 -0
  6. RinUI/components/Base.qml +79 -0
  7. RinUI/components/BasicInput/Button.qml +148 -0
  8. RinUI/components/BasicInput/CheckBox.qml +99 -0
  9. RinUI/components/BasicInput/ComboBox.qml +160 -0
  10. RinUI/components/BasicInput/DropDownButton.qml +21 -0
  11. RinUI/components/BasicInput/Hyperlink.qml +18 -0
  12. RinUI/components/BasicInput/RadioButton.qml +95 -0
  13. RinUI/components/BasicInput/Slider.qml +212 -0
  14. RinUI/components/BasicInput/Switch.qml +102 -0
  15. RinUI/components/BasicInput/ToggleButton.qml +11 -0
  16. RinUI/components/BasicInput/ToolButton.qml +31 -0
  17. RinUI/components/ContextMenu.qml +184 -0
  18. RinUI/components/DateAndTime/PickerView.qml +217 -0
  19. RinUI/components/DateAndTime/TimePicker.qml +115 -0
  20. RinUI/components/DialogsAndFlyouts/Dialog.qml +106 -0
  21. RinUI/components/DialogsAndFlyouts/DialogButtonBox.qml +47 -0
  22. RinUI/components/DialogsAndFlyouts/Flyout.qml +144 -0
  23. RinUI/components/DialogsAndFlyouts/Popup.qml +106 -0
  24. RinUI/components/FocusIndicator.qml +33 -0
  25. RinUI/components/IconWidget.qml +52 -0
  26. RinUI/components/Indicator.qml +90 -0
  27. RinUI/components/Layout/Expander.qml +160 -0
  28. RinUI/components/Layout/SettingExpander.qml +67 -0
  29. RinUI/components/Layout/SettingItem.qml +71 -0
  30. RinUI/components/ListAndCollections/Clip.qml +22 -0
  31. RinUI/components/ListAndCollections/Frame.qml +44 -0
  32. RinUI/components/ListAndCollections/ListView.qml +105 -0
  33. RinUI/components/ListAndCollections/ListViewDelegate.qml +83 -0
  34. RinUI/components/ListAndCollections/SettingCard.qml +73 -0
  35. RinUI/components/ListAndCollections/TableView.qml +82 -0
  36. RinUI/components/ListAndCollections/TableViewDelegate.qml +89 -0
  37. RinUI/components/MenusAndToolbars/Menu.qml +149 -0
  38. RinUI/components/MenusAndToolbars/MenuBar.qml +43 -0
  39. RinUI/components/MenusAndToolbars/MenuItem.qml +119 -0
  40. RinUI/components/MenusAndToolbars/MenuItemGroup.qml +43 -0
  41. RinUI/components/MenusAndToolbars/MenuSeparator.qml +14 -0
  42. RinUI/components/MenusAndToolbars/ToolSeparator.qml +17 -0
  43. RinUI/components/Navigation/ErrorPage.qml +48 -0
  44. RinUI/components/Navigation/NavigationBar.qml +179 -0
  45. RinUI/components/Navigation/NavigationItem.qml +193 -0
  46. RinUI/components/Navigation/NavigationSubItem.qml +103 -0
  47. RinUI/components/Navigation/NavigationView.qml +210 -0
  48. RinUI/components/Navigation/SelectorBar.qml +58 -0
  49. RinUI/components/ScrollBar.qml +163 -0
  50. RinUI/components/ScrollView.qml +13 -0
  51. RinUI/components/Shadow.qml +48 -0
  52. RinUI/components/StatusAndInfo/InfoBadge.qml +78 -0
  53. RinUI/components/StatusAndInfo/InfoBar.qml +246 -0
  54. RinUI/components/StatusAndInfo/ProgressBar.qml +127 -0
  55. RinUI/components/StatusAndInfo/Toast.qml +237 -0
  56. RinUI/components/StatusAndInfo/ToolTip.qml +93 -0
  57. RinUI/components/Text/SpinBox.qml +134 -0
  58. RinUI/components/Text/Text.qml +44 -0
  59. RinUI/components/Text/TextField.qml +94 -0
  60. RinUI/components/Text/TextInput.qml +29 -0
  61. RinUI/components/Utils/Blur.qml +42 -0
  62. RinUI/components/qmldir +76 -0
  63. RinUI/config/rin_ui.json +8 -0
  64. RinUI/core/__init__.py +3 -0
  65. RinUI/core/__pycache__/__init__.cpython-38.pyc +0 -0
  66. RinUI/core/__pycache__/config.cpython-38.pyc +0 -0
  67. RinUI/core/__pycache__/launcher.cpython-38.pyc +0 -0
  68. RinUI/core/__pycache__/theme.cpython-38.pyc +0 -0
  69. RinUI/core/config.py +109 -0
  70. RinUI/core/launcher.py +144 -0
  71. RinUI/core/theme.py +342 -0
  72. RinUI/hooks/__init__.py +3 -0
  73. RinUI/hooks/hook-RinUI.py +3 -0
  74. RinUI/qmldir +92 -0
  75. RinUI/themes/dark.qml +137 -0
  76. RinUI/themes/light.qml +137 -0
  77. RinUI/themes/qmldir +7 -0
  78. RinUI/themes/theme.qml +126 -0
  79. RinUI/themes/utils.qml +28 -0
  80. RinUI/utils/Animation.qml +12 -0
  81. RinUI/utils/FloatLayer.qml +123 -0
  82. RinUI/utils/FontIconLoader.qml +14 -0
  83. RinUI/utils/Position.qml +19 -0
  84. RinUI/utils/Severity.qml +13 -0
  85. RinUI/utils/Typography.qml +17 -0
  86. RinUI/utils/qmldir +5 -0
  87. RinUI/windows/CtrlBtn.qml +119 -0
  88. RinUI/windows/FluentPage.qml +92 -0
  89. RinUI/windows/FluentWindow.qml +32 -0
  90. RinUI/windows/FluentWindowBase.qml +157 -0
  91. RinUI/windows/TitleBar.qml +132 -0
  92. RinUI/windows/qmldir +8 -0
  93. RinUI/windows/window/ApplicationWindow.qml +9 -0
  94. RinUI/windows/window/Window.qml +112 -0
  95. rinui-0.0.9.data/data/LICENSE +21 -0
  96. rinui-0.0.9.data/data/README.md +90 -0
  97. rinui-0.0.9.dist-info/LICENSE +21 -0
  98. rinui-0.0.9.dist-info/METADATA +105 -0
  99. rinui-0.0.9.dist-info/RECORD +102 -0
  100. rinui-0.0.9.dist-info/WHEEL +5 -0
  101. rinui-0.0.9.dist-info/entry_points.txt +2 -0
  102. rinui-0.0.9.dist-info/top_level.txt +1 -0
@@ -0,0 +1,105 @@
1
+ import QtQuick 2.15
2
+ import QtQuick.Controls.Basic 2.15
3
+ import QtQuick.Layouts 2.15
4
+ import "../../themes"
5
+ import "../../components"
6
+
7
+ ListView {
8
+ id: root
9
+ property string textRole: "" // 文字role
10
+
11
+ property bool keyboardNavigation: false
12
+ // 自动检测模型类型
13
+ readonly property string modelType: {
14
+ if (!model) return "null";
15
+ if (Array.isArray(model) && root.textRole) return "array-with-role";
16
+ if (Array.isArray(model)) return "array";
17
+ if (model instanceof ListModel) return "listmodel";
18
+ if (typeof model === "object" && "count" in model) return "listmodel-like";
19
+ return "unknown";
20
+ }
21
+
22
+ clip: true
23
+
24
+ // 垂直滚动条 / Vertical ScrollBar //
25
+ ScrollBar.vertical: ScrollBar {
26
+ id: scrollBar
27
+ policy: ScrollBar.AsNeeded
28
+ }
29
+
30
+ // 交换动画
31
+ // move: Transition {
32
+ // NumberAnimation { property: "y"; duration: 200 }
33
+ // }
34
+ // moveDisplaced: Transition {
35
+ // NumberAnimation { property: "y"; duration: 200 }
36
+ // }
37
+
38
+ displaced: Transition {
39
+ NumberAnimation {
40
+ property: "y"
41
+ duration: Utils.animationSpeedMiddle
42
+ easing.type: Easing.OutQuint
43
+ }
44
+ }
45
+
46
+ add: Transition {
47
+ ParallelAnimation{
48
+ NumberAnimation {
49
+ property: "opacity"
50
+ from: 0
51
+ to: 1
52
+ duration: Utils.animationSpeed
53
+ easing.type: Easing.OutQuint
54
+ }
55
+ NumberAnimation {
56
+ properties: "scale"
57
+ from: 0.9
58
+ to: 1
59
+ duration: Utils.animationSpeed
60
+ easing.type: Easing.OutQuint
61
+ }
62
+ }
63
+ }
64
+
65
+ // 删除动画
66
+ remove: Transition {
67
+ ParallelAnimation{
68
+ NumberAnimation {
69
+ property: "opacity"
70
+ from: 1
71
+ to: 0
72
+ duration: Utils.animationSpeed
73
+ easing.type: Easing.OutQuint
74
+ }
75
+ NumberAnimation {
76
+ properties: "scale"
77
+ from: 1
78
+ to: 0.9
79
+ duration: Utils.animationSpeed
80
+ easing.type: Easing.OutQuint
81
+ }
82
+ }
83
+ }
84
+
85
+ delegate: ListViewDelegate {
86
+ middleArea: [
87
+ Text {
88
+ Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
89
+ id: text
90
+ typography: Typography.Body
91
+ wrapMode: Text.Wrap
92
+ text: {
93
+ switch (root.modelType) {
94
+ case "array": return modelData;
95
+ case "array-with-role": return modelData[root.textRole] || modelData || "";
96
+ case "listmodel":
97
+ case "listmodel-like":
98
+ return model[root.textRole] || modelData || "";
99
+ default: return "";
100
+ }
101
+ }
102
+ }
103
+ ]
104
+ }
105
+ }
@@ -0,0 +1,83 @@
1
+ import QtQuick 2.15
2
+ import QtQuick.Controls.Basic 2.15
3
+ import QtQuick.Layouts 2.15
4
+ import "../../themes"
5
+ import "../../components"
6
+
7
+
8
+ ItemDelegate {
9
+ id: delegate
10
+ width: ListView.view ? ListView.view.width : 200
11
+ height: contents.implicitHeight + 20 // 自适应
12
+ highlighted: ListView.isCurrentItem // 当前项高亮
13
+ focusPolicy: Qt.StrongFocus
14
+
15
+ // accessibility
16
+ FocusIndicator {
17
+ control: parent
18
+ }
19
+
20
+ property alias leftArea: leftArea.data
21
+ property alias middleArea: middleArea.data
22
+ property alias rightArea: rightArea.data
23
+ property alias contents: contents.data
24
+
25
+ RowLayout {
26
+ id: contents
27
+ anchors.fill: parent
28
+ anchors.leftMargin: 5 + 11
29
+ anchors.rightMargin: 5
30
+ anchors.topMargin: 3
31
+ spacing: 8
32
+
33
+ Row {
34
+ id: leftArea
35
+ }
36
+
37
+ ColumnLayout {
38
+ id: middleArea
39
+ Layout.fillHeight: true
40
+ }
41
+
42
+ RowLayout {
43
+ id: rightArea
44
+ spacing: 16
45
+ Layout.fillWidth: true
46
+ Layout.fillHeight: true
47
+ }
48
+ }
49
+
50
+ background: Rectangle {
51
+ id: itemBg
52
+ anchors.fill: parent
53
+ anchors.leftMargin: 5
54
+ anchors.rightMargin: 5
55
+ anchors.topMargin: 3
56
+ radius: Theme.currentTheme.appearance.buttonRadius
57
+ color: pressed
58
+ ? Theme.currentTheme.colors.subtleTertiaryColor
59
+ : (highlighted || hovered)
60
+ ? Theme.currentTheme.colors.subtleSecondaryColor
61
+ : Theme.currentTheme.colors.subtleColor
62
+
63
+ RowLayout {
64
+ anchors.fill: parent
65
+ anchors.leftMargin: 11
66
+ anchors.rightMargin: 11
67
+ anchors.topMargin: 6
68
+ anchors.bottomMargin: 8
69
+ }
70
+
71
+ // 选择指示器
72
+ Indicator {
73
+ currentItemHeight: delegate.height
74
+ visible: highlighted
75
+ }
76
+
77
+ Behavior on color { ColorAnimation { duration: Utils.appearanceSpeed; easing.type:Easing.InOutQuart } }
78
+ }
79
+
80
+ onClicked: {
81
+ ListView.view.currentIndex = index
82
+ }
83
+ }
@@ -0,0 +1,73 @@
1
+ import QtQuick 2.15
2
+ import QtQuick.Controls 2.15
3
+ import QtQuick.Layouts 2.15
4
+ import RinUI
5
+
6
+
7
+ // 自定义控件演示 / Custom control demonstration //
8
+ Frame {
9
+ id: frame
10
+ default property alias content: rightContent.data
11
+ // property alias showcase: showcaseContainer.data
12
+ property string title
13
+ property alias icon: icon.icon
14
+ property alias source: icon.source
15
+ property alias iconSize: icon.size
16
+ property string description
17
+
18
+ leftPadding: 15
19
+ rightPadding: 15
20
+ topPadding: 13
21
+ bottomPadding: 13
22
+ // implicitHeight: 62
23
+
24
+ RowLayout {
25
+ anchors.fill: parent
26
+ spacing: 16
27
+
28
+ RowLayout {
29
+ id: leftContent
30
+ Layout.maximumWidth: parent.width * 0.6
31
+ Layout.fillHeight: true
32
+ spacing: 16
33
+
34
+ IconWidget {
35
+ id: icon
36
+ size: 20
37
+ }
38
+ ColumnLayout {
39
+ Layout.fillWidth: true
40
+ spacing: 0
41
+ Text {
42
+ id: titleLabel
43
+ Layout.fillWidth: true
44
+ typography: Typography.Body
45
+ text: title
46
+ maximumLineCount: 2 // 限制最多两行
47
+ elide: Text.ElideRight // 超过限制时用省略号
48
+ visible: title.length > 0
49
+ }
50
+
51
+ Text {
52
+ id: discriptionLabel
53
+ Layout.fillWidth: true
54
+ typography: Typography.Caption
55
+ text: description
56
+ color: Theme.currentTheme.colors.textSecondaryColor
57
+ wrapMode: Text.Wrap // 启用换行
58
+ maximumLineCount: 3
59
+ elide: Text.ElideRight
60
+ visible: description.length > 0
61
+ }
62
+ }
63
+ visible: !(!titleLabel.visible && !discriptionLabel.visible)
64
+ }
65
+ RowLayout {
66
+ id: rightContent
67
+ Layout.fillWidth: true
68
+ Layout.fillHeight: true
69
+ Layout.alignment: Qt.AlignRight
70
+ spacing: 16
71
+ }
72
+ }
73
+ }
@@ -0,0 +1,82 @@
1
+ import QtQuick 2.15
2
+ import QtQuick.Controls.Basic 2.15
3
+ import QtQuick.Layouts 2.15
4
+ import "../../themes"
5
+ import "../../components"
6
+
7
+ TableView {
8
+ id: root
9
+ clip: true
10
+
11
+ // 滚动条 / ScrollBar //
12
+ ScrollBar.vertical: ScrollBar {
13
+ policy: ScrollBar.AsNeeded
14
+ }
15
+ ScrollBar.horizontal: ScrollBar {
16
+ policy: ScrollBar.AsNeeded
17
+ }
18
+
19
+ // 交换动画
20
+ // move: Transition {
21
+ // NumberAnimation { property: "y"; duration: 200 }
22
+ // }
23
+ // moveDisplaced: Transition {
24
+ // NumberAnimation { property: "y"; duration: 200 }
25
+ // }
26
+
27
+ // displaced: Transition {
28
+ // NumberAnimation {
29
+ // property: "y"
30
+ // duration: Utils.animationSpeedMiddle
31
+ // easing.type: Easing.OutQuint
32
+ // }
33
+ // }
34
+ //
35
+ // add: Transition {
36
+ // ParallelAnimation{
37
+ // NumberAnimation {
38
+ // property: "opacity"
39
+ // from: 0
40
+ // to: 1
41
+ // duration: Utils.animationSpeed
42
+ // easing.type: Easing.OutQuint
43
+ // }
44
+ // NumberAnimation {
45
+ // properties: "scale"
46
+ // from: 0.9
47
+ // to: 1
48
+ // duration: Utils.animationSpeed
49
+ // easing.type: Easing.OutQuint
50
+ // }
51
+ // }
52
+ // }
53
+ //
54
+ // // 删除动画
55
+ // remove: Transition {
56
+ // ParallelAnimation{
57
+ // NumberAnimation {
58
+ // property: "opacity"
59
+ // from: 1
60
+ // to: 0
61
+ // duration: Utils.animationSpeed
62
+ // easing.type: Easing.OutQuint
63
+ // }
64
+ // NumberAnimation {
65
+ // properties: "scale"
66
+ // from: 1
67
+ // to: 0.9
68
+ // duration: Utils.animationSpeed
69
+ // easing.type: Easing.OutQuint
70
+ // }
71
+ // }
72
+ // }
73
+
74
+ delegate: TableViewDelegate {
75
+ middleArea: [
76
+ Text {
77
+ Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
78
+ text: model.display
79
+ }
80
+ ]
81
+ }
82
+ }
@@ -0,0 +1,89 @@
1
+ import QtQuick 2.15
2
+ import QtQuick.Controls.Basic 2.15
3
+ import QtQuick.Layouts 2.15
4
+ import "../../themes"
5
+ import "../../components"
6
+
7
+
8
+ ItemDelegate {
9
+ id: delegate
10
+ width: TableView.view ? TableView.view.width : 200
11
+ height: contents.implicitHeight + 20 // 自适应
12
+ highlighted: false
13
+ focusPolicy: Qt.StrongFocus
14
+
15
+ // accessibility
16
+ FocusIndicator {
17
+ control: parent
18
+ }
19
+
20
+ property alias leftArea: leftArea.data
21
+ property alias middleArea: middleArea.data
22
+ property alias rightArea: rightArea.data
23
+
24
+ contentItem: RowLayout {
25
+ id: contents
26
+ anchors.fill: parent
27
+ anchors.leftMargin: 5 + 11
28
+ anchors.rightMargin: 5
29
+ anchors.topMargin: 3
30
+ spacing: 8
31
+
32
+ Row {
33
+ id: leftArea
34
+ // CheckBox {
35
+ // id: checkBox
36
+ // implicitWidth: height * 1
37
+ // Layout.fillHeight: true
38
+ // checked: false
39
+ // visible: tableCell.column === 0
40
+ // }
41
+ }
42
+
43
+ ColumnLayout {
44
+ id: middleArea
45
+ Layout.fillHeight: true
46
+ }
47
+
48
+ RowLayout {
49
+ id: rightArea
50
+ spacing: 16
51
+ Layout.fillWidth: true
52
+ Layout.fillHeight: true
53
+ }
54
+ }
55
+
56
+ background: Rectangle {
57
+ id: itemBg
58
+ anchors.fill: parent
59
+ // anchors.leftMargin: 5
60
+ // anchors.rightMargin: 5
61
+ anchors.topMargin: 3
62
+ radius: Theme.currentTheme.appearance.buttonRadius
63
+ color: pressed
64
+ ? Theme.currentTheme.colors.subtleTertiaryColor
65
+ : (highlighted || hovered)
66
+ ? Theme.currentTheme.colors.subtleSecondaryColor
67
+ : Theme.currentTheme.colors.subtleColor
68
+
69
+ RowLayout {
70
+ anchors.fill: parent
71
+ anchors.leftMargin: 11
72
+ anchors.rightMargin: 11
73
+ anchors.topMargin: 6
74
+ anchors.bottomMargin: 8
75
+ }
76
+
77
+ // 选择指示器
78
+ Indicator {
79
+ currentItemHeight: delegate.height
80
+ visible: highlighted
81
+ }
82
+
83
+ Behavior on color { ColorAnimation { duration: Utils.appearanceSpeed; easing.type:Easing.InOutQuart } }
84
+ }
85
+
86
+ onClicked: {
87
+ // TableView.selected = row
88
+ }
89
+ }
@@ -0,0 +1,149 @@
1
+ import QtQuick 2.15
2
+ import QtQuick.Controls 2.15
3
+ import "../../themes"
4
+ import "../../components"
5
+
6
+
7
+ Menu {
8
+ id: root
9
+
10
+ property int position: Position.Bottom // 位置
11
+
12
+ property real posX: {
13
+ switch (position) {
14
+ case Position.Top:
15
+ case Position.Bottom:
16
+ return (parent.width - root.width) / 2
17
+ case Position.Left:
18
+ return - root.width - 5
19
+ case Position.Right:
20
+ return parent.width + 5
21
+ default:
22
+ return (parent.width - root.width) / 2
23
+ }
24
+ }
25
+
26
+ property real posY: {
27
+ switch (position) {
28
+ case Position.Top:
29
+ return -root.height - 5
30
+ case Position.Bottom:
31
+ return parent.height + 5
32
+ case Position.Left:
33
+ case Position.Right:
34
+ return (parent.height - root.height) / 2
35
+ default:
36
+ return -root.height + 5 // 默认顶部
37
+ }
38
+ }
39
+
40
+ implicitWidth: Math.max(contentItem.implicitWidth, 80)
41
+ implicitHeight: contentItem.implicitHeight
42
+ // x: (parent.width - root.width) / 2
43
+ // y: parent.height + 5
44
+
45
+ enter: Transition {
46
+ ParallelAnimation {
47
+ NumberAnimation {
48
+ target: root
49
+ property: "opacity"
50
+ from: 0
51
+ to: 1
52
+ duration: 70
53
+ easing.type: Easing.InOutQuart
54
+ }
55
+ NumberAnimation {
56
+ target: root
57
+ property: "height"
58
+ from: (position === Position.Top || position === Position.Bottom ? 0 : root.implicitHeight)
59
+ to: root.implicitHeight
60
+ duration: Utils.animationSpeed
61
+ easing.type: Easing.OutQuart
62
+ }
63
+ NumberAnimation {
64
+ target: root
65
+ property: "x"
66
+ from: posX + (position === Position.Left ? 5 : position === Position.Right ? -5 : 0)
67
+ to: posX
68
+ duration: Utils.animationSpeedMiddle
69
+ easing.type: Easing.OutQuint
70
+ onRunningChanged: {
71
+ scrollBar.visible = true;
72
+ }
73
+ }
74
+ NumberAnimation {
75
+ target: root
76
+ property: "y"
77
+ from: posY + (position === Position.Top || position === Position.Bottom
78
+ ? (position === Position.Top ? implicitHeight / 2 : position === Position.Bottom ? -implicitHeight / 2 : implicitHeight / 2)
79
+ : 0)
80
+ to: posY
81
+ duration: Utils.animationSpeedMiddle
82
+ easing.type: Easing.OutQuint
83
+ onRunningChanged: {
84
+ scrollBar.visible = true;
85
+ }
86
+ }
87
+ }
88
+ }
89
+ exit: Transition {
90
+ ParallelAnimation {
91
+ NumberAnimation {
92
+ target: root
93
+ property: "opacity"
94
+ from: 1
95
+ to: 0
96
+ duration: 150
97
+ easing.type: Easing.InOutQuart
98
+ }
99
+ }
100
+ }
101
+
102
+ spacing: 5
103
+ topPadding: 5
104
+ bottomPadding: 5
105
+
106
+ background: Rectangle {
107
+ implicitWidth: 80
108
+ implicitHeight: 36
109
+ radius: Theme.currentTheme.appearance.windowRadius
110
+ color: Theme.currentTheme.colors.backgroundAcrylicColor
111
+ border.color: Theme.currentTheme.colors.flyoutBorderColor
112
+
113
+ layer.enabled: true
114
+ layer.effect: Shadow {
115
+ id: shadow
116
+ style: "flyout"
117
+ source: background
118
+ }
119
+ }
120
+
121
+ delegate: MenuItem { }
122
+
123
+ contentItem: Flickable {
124
+ id: flickable
125
+ clip: true
126
+ anchors.fill: parent
127
+ // contentWidth: width
128
+ // contentHeight: column.implicitHeight
129
+ implicitWidth: column.implicitWidth
130
+ implicitHeight: column.implicitHeight
131
+ // interactive: column.implicitHeight > height
132
+
133
+ Column {
134
+ id: column
135
+ topPadding: 5
136
+ bottomPadding: 5
137
+ Repeater {
138
+ model: root.contentModel // 默认的 Menu 内容
139
+ delegate: root.delegate
140
+ }
141
+ }
142
+
143
+ ScrollBar.vertical: ScrollBar {
144
+ id: scrollBar
145
+ policy: ScrollBar.AsNeeded
146
+ visible: false // 初始隐藏,在 enter 动画中显现
147
+ }
148
+ }
149
+ }
@@ -0,0 +1,43 @@
1
+ import QtQuick 2.15
2
+ import QtQuick.Controls.Basic 2.15
3
+ import "../../components"
4
+ import "../../themes"
5
+
6
+ MenuBar {
7
+ id: menuBar
8
+ padding: 4
9
+
10
+ delegate: MenuBarItem {
11
+ id: menuBarItem
12
+ focusPolicy: Qt.StrongFocus // to get keyboard focus
13
+
14
+ // accessibility
15
+ FocusIndicator {
16
+ control: parent
17
+ }
18
+
19
+ padding: 6
20
+ topPadding: 5
21
+ bottomPadding: 7
22
+
23
+ contentItem: Text {
24
+ id: text
25
+ anchors.centerIn: parent
26
+ typography: Typography.Body
27
+ horizontalAlignment: Text.AlignHCenter
28
+ text: menuBarItem.text
29
+ }
30
+
31
+ background: Rectangle {
32
+ id: background
33
+ implicitHeight: 32
34
+ color: Theme.currentTheme.colors.subtleSecondaryColor
35
+ radius: Theme.currentTheme.appearance.buttonRadius
36
+
37
+ Behavior on color { ColorAnimation { duration: Utils.appearanceSpeed; easing.type: Easing.OutQuart } }
38
+ opacity: !hovered ? 0 : 1
39
+ }
40
+ }
41
+
42
+ background: Item {}
43
+ }