File tree Expand file tree Collapse file tree 4 files changed +28
-26
lines changed
Qt5/imports/FluentUI/Controls
Qt6/imports/FluentUI/Controls Expand file tree Collapse file tree 4 files changed +28
-26
lines changed Original file line number Diff line number Diff line change 24
24
}
25
25
QtObject{
26
26
id: d
27
- property bool flagXChanged: true
27
+ property bool flagXChanged: false
28
28
property bool isAnimEnable: control .autoPlay && list_view .count > 3
29
29
function setData (data ){
30
30
if (! data){
@@ -88,14 +88,17 @@ Item {
88
88
}
89
89
}
90
90
onMovementEnded: {
91
+ d .flagXChanged = false
92
+ list_view .highlightMoveDuration = 0
91
93
currentIndex = list_view .contentX / list_view .width
92
94
if (currentIndex === 0 ){
93
95
currentIndex = list_view .count - 2
94
96
}else if (currentIndex === list_view .count - 1 ){
95
97
currentIndex = 1
96
98
}
97
- d .flagXChanged = false
98
- timer_run .restart ()
99
+ if (d .isAnimEnable ){
100
+ timer_run .restart ()
101
+ }
99
102
}
100
103
onMovementStarted: {
101
104
d .flagXChanged = true
@@ -104,12 +107,12 @@ Item {
104
107
onContentXChanged: {
105
108
if (d .flagXChanged ){
106
109
var maxX = Math .min (list_view .width * (currentIndex+ 1 ),list_view .count * list_view .width )
107
- var minY = Math .max (0 ,(list_view .width * (currentIndex- 1 )))
110
+ var minX = Math .max (0 ,(list_view .width * (currentIndex- 1 )))
108
111
if (contentX>= maxX){
109
112
contentX = maxX
110
113
}
111
- if (contentX<= minY ){
112
- contentX = minY
114
+ if (contentX<= minX ){
115
+ contentX = minX
113
116
}
114
117
}
115
118
}
Original file line number Diff line number Diff line change @@ -14,13 +14,6 @@ ProgressBar{
14
14
id: d
15
15
property real _radius: strokeWidth/ 2
16
16
}
17
- onIndeterminateChanged: {
18
- if (! indeterminate){
19
- animator_x .duration = 0
20
- rect_progress .x = 0
21
- animator_x .duration = control .duration
22
- }
23
- }
24
17
background: Rectangle {
25
18
implicitWidth: 150
26
19
implicitHeight: control .strokeWidth
@@ -45,6 +38,11 @@ ProgressBar{
45
38
id: animator_x
46
39
running: control .indeterminate && control .visible
47
40
loops: Animation .Infinite
41
+ onRunningChanged: {
42
+ if (! running){
43
+ rect_progress .x = 0
44
+ }
45
+ }
48
46
PropertyAnimation {
49
47
from: - rect_progress .width
50
48
to: control .width + rect_progress .width
Original file line number Diff line number Diff line change 24
24
}
25
25
QtObject{
26
26
id: d
27
- property bool flagXChanged: true
27
+ property bool flagXChanged: false
28
28
property bool isAnimEnable: control .autoPlay && list_view .count > 3
29
29
function setData (data ){
30
30
if (! data){
@@ -88,14 +88,17 @@ Item {
88
88
}
89
89
}
90
90
onMovementEnded: {
91
+ d .flagXChanged = false
92
+ list_view .highlightMoveDuration = 0
91
93
currentIndex = list_view .contentX / list_view .width
92
94
if (currentIndex === 0 ){
93
95
currentIndex = list_view .count - 2
94
96
}else if (currentIndex === list_view .count - 1 ){
95
97
currentIndex = 1
96
98
}
97
- d .flagXChanged = false
98
- timer_run .restart ()
99
+ if (d .isAnimEnable ){
100
+ timer_run .restart ()
101
+ }
99
102
}
100
103
onMovementStarted: {
101
104
d .flagXChanged = true
@@ -104,12 +107,12 @@ Item {
104
107
onContentXChanged: {
105
108
if (d .flagXChanged ){
106
109
var maxX = Math .min (list_view .width * (currentIndex+ 1 ),list_view .count * list_view .width )
107
- var minY = Math .max (0 ,(list_view .width * (currentIndex- 1 )))
110
+ var minX = Math .max (0 ,(list_view .width * (currentIndex- 1 )))
108
111
if (contentX>= maxX){
109
112
contentX = maxX
110
113
}
111
- if (contentX<= minY ){
112
- contentX = minY
114
+ if (contentX<= minX ){
115
+ contentX = minX
113
116
}
114
117
}
115
118
}
Original file line number Diff line number Diff line change @@ -15,13 +15,6 @@ ProgressBar{
15
15
id: d
16
16
property real _radius: strokeWidth/ 2
17
17
}
18
- onIndeterminateChanged: {
19
- if (! indeterminate){
20
- animator_x .duration = 0
21
- rect_progress .x = 0
22
- animator_x .duration = control .duration
23
- }
24
- }
25
18
background: Rectangle {
26
19
implicitWidth: 150
27
20
implicitHeight: control .strokeWidth
@@ -46,6 +39,11 @@ ProgressBar{
46
39
id: animator_x
47
40
running: control .indeterminate && control .visible
48
41
loops: Animation .Infinite
42
+ onRunningChanged: {
43
+ if (! running){
44
+ rect_progress .x = 0
45
+ }
46
+ }
49
47
PropertyAnimation {
50
48
from: - rect_progress .width
51
49
to: control .width + rect_progress .width
You can’t perform that action at this time.
0 commit comments