This commit is contained in:
朱子楚\zhuzi 2023-03-15 20:40:30 +08:00
commit 47597471dd
4 changed files with 14 additions and 48 deletions

View File

@ -9,13 +9,11 @@ FluScrollablePage{
title:"Carousel"
FluArea{
width: parent.width
height: 370
paddings: 10
Layout.topMargin: 20
Column{
spacing: 15
anchors{
@ -23,7 +21,6 @@ FluScrollablePage{
left:parent.left
}
FluText{
text:"轮播图支持无限轮播无限滑动用ListView实现的组件"
}
FluCarousel{
@ -33,12 +30,7 @@ FluScrollablePage{
Component.onCompleted: {
carousel.setData([{url:"qrc:/res/image/banner_1.jpg"},{url:"qrc:/res/image/banner_2.jpg"},{url:"qrc:/res/image/banner_3.jpg"}])
}
}
}
}
}

View File

@ -34,7 +34,7 @@ FluWindow {
fontStyle: FluText.Title
}
FluText{
text:"v1.0.8"
text:"v1.0.9"
fontStyle: FluText.Body
Layout.alignment: Qt.AlignBottom
}

View File

@ -58,13 +58,6 @@ FluWindow {
}
}
FluPaneItem{
title:"Menu"
onTap:{
nav_view.push("qrc:/T_Menu.qml")
}
}
FluPaneItem{
title:"TimePicker"
onTap:{
@ -123,7 +116,6 @@ FluWindow {
title:"Popus"
}
FluPaneItem{
title:"Dialog"
onTap:{
@ -131,6 +123,13 @@ FluWindow {
}
}
FluPaneItem{
title:"Menu"
onTap:{
nav_view.push("qrc:/T_Menu.qml")
}
}
FluPaneItemHeader{
title:"Navigation"
}

View File

@ -4,22 +4,17 @@ import FluentUI 1.0
Item {
id:control
property bool flagXChanged: true
property int radius : 5
property int loopTime: 2000
property bool showIndicator: true
id:control
width: 400
height: 300
ListModel{
id:content_model
}
FluRectangle{
anchors.fill: parent
radius: [control.radius,control.radius,control.radius,control.radius]
@ -33,12 +28,14 @@ Item {
clip: true
boundsBehavior: ListView.StopAtBounds
model:content_model
maximumFlickVelocity: 4 * (list_view.orientation ===
Qt.Horizontal ? width : height)
maximumFlickVelocity: 4 * (list_view.orientation === Qt.Horizontal ? width : height)
preferredHighlightBegin: 0
preferredHighlightEnd: 0
highlightMoveDuration: 0
orientation : ListView.Horizontal
delegate: Item{
width: ListView.view.width
height: ListView.view.height
property int displayIndex: {
if(index === 0)
return content_model.count-3
@ -46,19 +43,12 @@ Item {
return 0
return index-1
}
Image {
anchors.fill: parent
source: model.url
fillMode:Image.PreserveAspectCrop
}
}
preferredHighlightBegin: 0
preferredHighlightEnd: 0
highlightMoveDuration: 0
onMovementEnded:{
currentIndex = list_view.contentX/list_view.width
if(currentIndex === 0){
@ -69,15 +59,11 @@ Item {
flagXChanged = false
timer_run.start()
}
onMovementStarted: {
flagXChanged = true
timer_run.stop()
}
onContentXChanged: {
if(flagXChanged){
var maxX = Math.min(list_view.width*(currentIndex+1),list_view.count*list_view.width)
var minY = Math.max(0,(list_view.width*(currentIndex-1)))
@ -89,11 +75,8 @@ Item {
}
}
}
orientation : ListView.Horizontal
}
}
function setData(data){
content_model.clear()
content_model.append(data[data.length-1])
@ -102,7 +85,6 @@ Item {
list_view.currentIndex = 1
timer_run.restart()
}
Row{
spacing: 10
anchors{
@ -131,9 +113,6 @@ Item {
}
}
}
Timer{
id:timer_anim
interval: 250
@ -144,7 +123,6 @@ Item {
}
}
}
Timer{
id:timer_run
interval: control.loopTime
@ -153,9 +131,6 @@ Item {
list_view.highlightMoveDuration = 250
list_view.currentIndex = list_view.currentIndex+1
timer_anim.start()
}
}
}