mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-02-09 00:05:39 +08:00
fix #266
This commit is contained in:
parent
56a62f0b29
commit
82a3f85f10
@ -3,6 +3,7 @@ import QtQuick.Controls 2.15
|
|||||||
import FluentUI 1.0
|
import FluentUI 1.0
|
||||||
|
|
||||||
FluItem {
|
FluItem {
|
||||||
|
property bool autoPlay: true
|
||||||
property int loopTime: 2000
|
property int loopTime: 2000
|
||||||
property var model
|
property var model
|
||||||
property Component delegate
|
property Component delegate
|
||||||
@ -24,6 +25,7 @@ FluItem {
|
|||||||
QtObject{
|
QtObject{
|
||||||
id:d
|
id:d
|
||||||
property bool flagXChanged: true
|
property bool flagXChanged: true
|
||||||
|
property bool isAnimEnable: control.autoPlay && list_view.count>3
|
||||||
function setData(data){
|
function setData(data){
|
||||||
if(!data){
|
if(!data){
|
||||||
return
|
return
|
||||||
@ -35,7 +37,9 @@ FluItem {
|
|||||||
list_view.highlightMoveDuration = 0
|
list_view.highlightMoveDuration = 0
|
||||||
list_view.currentIndex = 1
|
list_view.currentIndex = 1
|
||||||
list_view.highlightMoveDuration = 250
|
list_view.highlightMoveDuration = 250
|
||||||
timer_run.restart()
|
if(d.isAnimEnable){
|
||||||
|
timer_run.restart()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ListView{
|
ListView{
|
||||||
@ -52,6 +56,7 @@ FluItem {
|
|||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
d.setData(control.model)
|
d.setData(control.model)
|
||||||
}
|
}
|
||||||
|
interactive: list_view.count>3
|
||||||
Connections{
|
Connections{
|
||||||
target: control
|
target: control
|
||||||
function onModelChanged(){
|
function onModelChanged(){
|
||||||
@ -182,20 +187,20 @@ FluItem {
|
|||||||
Timer{
|
Timer{
|
||||||
id:timer_run
|
id:timer_run
|
||||||
interval: control.loopTime
|
interval: control.loopTime
|
||||||
repeat: true
|
repeat: d.isAnimEnable
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
list_view.highlightMoveDuration = 250
|
list_view.highlightMoveDuration = 250
|
||||||
list_view.currentIndex = list_view.currentIndex+1
|
list_view.currentIndex = list_view.currentIndex+1
|
||||||
timer_anim.start()
|
timer_anim.start()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function changedIndex(index){
|
function changedIndex(index){
|
||||||
d.flagXChanged = true
|
d.flagXChanged = true
|
||||||
timer_run.stop()
|
timer_run.stop()
|
||||||
list_view.currentIndex = index
|
list_view.currentIndex = index
|
||||||
d.flagXChanged = false
|
d.flagXChanged = false
|
||||||
timer_run.restart()
|
if(d.isAnimEnable){
|
||||||
|
timer_run.restart()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ import QtQuick.Controls
|
|||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
FluItem {
|
FluItem {
|
||||||
|
property bool autoPlay: true
|
||||||
property int loopTime: 2000
|
property int loopTime: 2000
|
||||||
property var model
|
property var model
|
||||||
property Component delegate
|
property Component delegate
|
||||||
@ -24,6 +25,7 @@ FluItem {
|
|||||||
QtObject{
|
QtObject{
|
||||||
id:d
|
id:d
|
||||||
property bool flagXChanged: true
|
property bool flagXChanged: true
|
||||||
|
property bool isAnimEnable: control.autoPlay && list_view.count>3
|
||||||
function setData(data){
|
function setData(data){
|
||||||
if(!data){
|
if(!data){
|
||||||
return
|
return
|
||||||
@ -35,7 +37,9 @@ FluItem {
|
|||||||
list_view.highlightMoveDuration = 0
|
list_view.highlightMoveDuration = 0
|
||||||
list_view.currentIndex = 1
|
list_view.currentIndex = 1
|
||||||
list_view.highlightMoveDuration = 250
|
list_view.highlightMoveDuration = 250
|
||||||
timer_run.restart()
|
if(d.isAnimEnable){
|
||||||
|
timer_run.restart()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ListView{
|
ListView{
|
||||||
@ -52,6 +56,7 @@ FluItem {
|
|||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
d.setData(control.model)
|
d.setData(control.model)
|
||||||
}
|
}
|
||||||
|
interactive: list_view.count>3
|
||||||
Connections{
|
Connections{
|
||||||
target: control
|
target: control
|
||||||
function onModelChanged(){
|
function onModelChanged(){
|
||||||
@ -182,20 +187,20 @@ FluItem {
|
|||||||
Timer{
|
Timer{
|
||||||
id:timer_run
|
id:timer_run
|
||||||
interval: control.loopTime
|
interval: control.loopTime
|
||||||
repeat: true
|
repeat: d.isAnimEnable
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
list_view.highlightMoveDuration = 250
|
list_view.highlightMoveDuration = 250
|
||||||
list_view.currentIndex = list_view.currentIndex+1
|
list_view.currentIndex = list_view.currentIndex+1
|
||||||
timer_anim.start()
|
timer_anim.start()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function changedIndex(index){
|
function changedIndex(index){
|
||||||
d.flagXChanged = true
|
d.flagXChanged = true
|
||||||
timer_run.stop()
|
timer_run.stop()
|
||||||
list_view.currentIndex = index
|
list_view.currentIndex = index
|
||||||
d.flagXChanged = false
|
d.flagXChanged = false
|
||||||
timer_run.restart()
|
if(d.isAnimEnable){
|
||||||
|
timer_run.restart()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user