diff --git a/example/T_Carousel.qml b/example/T_Carousel.qml index 43f8d5c9..8358a4fb 100644 --- a/example/T_Carousel.qml +++ b/example/T_Carousel.qml @@ -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"}]) } - } } } - - - - } diff --git a/example/page/AboutPage.qml b/example/page/AboutPage.qml index d3a6c37c..6ce269ef 100644 --- a/example/page/AboutPage.qml +++ b/example/page/AboutPage.qml @@ -34,7 +34,7 @@ FluWindow { fontStyle: FluText.Title } FluText{ - text:"v1.0.8" + text:"v1.0.9" fontStyle: FluText.Body Layout.alignment: Qt.AlignBottom } diff --git a/example/page/MainPage.qml b/example/page/MainPage.qml index 9c7ddf04..dd3c7c51 100644 --- a/example/page/MainPage.qml +++ b/example/page/MainPage.qml @@ -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" } diff --git a/src/controls/FluCarousel.qml b/src/controls/FluCarousel.qml index 475bd882..c521386e 100644 --- a/src/controls/FluCarousel.qml +++ b/src/controls/FluCarousel.qml @@ -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() - } } - } -