main
zhuzihcu 2023-03-15 18:45:14 +08:00
parent 1e4f939de7
commit 31b2b0b004
4 changed files with 14 additions and 48 deletions

View File

@ -9,13 +9,11 @@ FluScrollablePage{
title:"Carousel" title:"Carousel"
FluArea{ FluArea{
width: parent.width width: parent.width
height: 370 height: 370
paddings: 10 paddings: 10
Layout.topMargin: 20 Layout.topMargin: 20
Column{ Column{
spacing: 15 spacing: 15
anchors{ anchors{
@ -23,7 +21,6 @@ FluScrollablePage{
left:parent.left left:parent.left
} }
FluText{ FluText{
text:"轮播图支持无限轮播无限滑动用ListView实现的组件" text:"轮播图支持无限轮播无限滑动用ListView实现的组件"
} }
FluCarousel{ FluCarousel{
@ -33,12 +30,7 @@ FluScrollablePage{
Component.onCompleted: { 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"}]) 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 fontStyle: FluText.Title
} }
FluText{ FluText{
text:"v1.0.8" text:"v1.0.9"
fontStyle: FluText.Body fontStyle: FluText.Body
Layout.alignment: Qt.AlignBottom Layout.alignment: Qt.AlignBottom
} }

View File

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

View File

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