Skip to content

Commit e83a021

Browse files
committed
Update: 来自[DelegateUI]的一些更新.
1 parent 8835a03 commit e83a021

File tree

4 files changed

+20
-9
lines changed

4 files changed

+20
-9
lines changed

DelButton/DelButton.qml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ Button {
1818
Shape_Circle = 1
1919
}
2020

21-
enum IconPosition {
22-
Position_Start = 0,
23-
Position_End = 1
24-
}
25-
2621
property bool animationEnabled: true
2722
property bool effectEnabled: true
2823
property int hoverCursorShape: Qt.PointingHandCursor

DelButton/DelIconButton.qml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,16 @@ import "qrc:/../common"
66
DelButton {
77
id: control
88

9+
enum IconPosition {
10+
Position_Start = 0,
11+
Position_End = 1
12+
}
13+
14+
property bool loading: false
915
property int iconSource: 0
1016
property int iconSize: 16
1117
property int iconSpacing: 5
12-
property int iconPosition: DelButton.Position_Start
18+
property int iconPosition: DelIconButton.Position_Start
1319
property color colorIcon: colorText
1420
contentItem: Item {
1521
implicitWidth: __row.implicitWidth
@@ -20,17 +26,25 @@ DelButton {
2026
anchors.horizontalCenter: parent.horizontalCenter
2127
anchors.verticalCenter: parent.verticalCenter
2228
spacing: control.iconSpacing
23-
layoutDirection: control.iconPosition === DelButton.Position_Start ? Qt.LeftToRight : Qt.RightToLeft
29+
layoutDirection: control.iconPosition === DelIconButton.Position_Start ? Qt.LeftToRight : Qt.RightToLeft
2430

2531
DelIconText {
2632
id: __icon
2733
anchors.verticalCenter: parent.verticalCenter
2834
color: control.colorIcon
2935
iconSize: control.iconSize
30-
iconSource: control.iconSource
36+
iconSource: control.loading ? DelIcon.LoadingOutlined : control.iconSource
3137
verticalAlignment: Text.AlignVCenter
3238

3339
Behavior on color { enabled: control.animationEnabled; ColorAnimation { duration: 100 } }
40+
41+
NumberAnimation on rotation {
42+
running: control.loading
43+
from: 0
44+
to: 360
45+
loops: Animation.Infinite
46+
duration: 1000
47+
}
3448
}
3549

3650
Text {

DelButton/main.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ Window {
162162

163163
DelIconButton {
164164
type: DelButton.Type_Text
165-
iconPosition: DelButton.Position_End
165+
iconPosition: DelIconButton.Position_End
166166
iconSource: DelIcon.GiftOutlined
167167
text: qsTr("礼物")
168168
}

DelTag/DelTag.pro

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
QT += quick
22

3+
CONFIG += c++17
4+
35
# You can make your code fail to compile if it uses deprecated APIs.
46
# In order to do so, uncomment the following line.
57
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0

0 commit comments

Comments
 (0)