Compare commits

...

5 Commits
1.0.7 ... 1.0.8

Author SHA1 Message Date
1e4f939de7 update 2023-03-15 14:49:33 +08:00
926132a285 update 2023-03-15 14:48:48 +08:00
9e245fb533 update 2023-03-15 00:36:49 +08:00
8bfbfd63fb update 2023-03-15 00:33:38 +08:00
51a206e583 update 2023-03-14 18:23:12 +08:00
18 changed files with 244 additions and 23 deletions

44
example/T_Carousel.qml Normal file
View File

@ -0,0 +1,44 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.15
import QtGraphicalEffects 1.15
import FluentUI 1.0
FluScrollablePage{
title:"Carousel"
FluArea{
width: parent.width
height: 370
paddings: 10
Layout.topMargin: 20
Column{
spacing: 15
anchors{
verticalCenter: parent.verticalCenter
left:parent.left
}
FluText{
text:"轮播图支持无限轮播无限滑动用ListView实现的组件"
}
FluCarousel{
id:carousel
Layout.topMargin: 20
Layout.leftMargin: 5
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.7"
text:"v1.0.8"
fontStyle: FluText.Body
Layout.alignment: Qt.AlignBottom
}

View File

@ -19,7 +19,6 @@ FluWindow {
title: "FluentUI"
}
FluObject{
id:original_items
@ -97,12 +96,22 @@ FluWindow {
nav_view.push("qrc:/T_Progress.qml")
}
}
FluPaneItem{
title:"Rectangle"
onTap:{
nav_view.push("qrc:/T_Rectangle.qml")
}
}
FluPaneItem{
title:"Carousel"
onTap:{
nav_view.push("qrc:/T_Carousel.qml")
}
}
FluPaneItem{
title:"Expander"
onTap:{

View File

@ -1,8 +1,6 @@
<RCC>
<qresource prefix="/">
<file>App.qml</file>
<file>res/image/image_huoyin.webp</file>
<file>res/svg/avatar_1.svg</file>
<file>res/svg/avatar_2.svg</file>
@ -16,12 +14,10 @@
<file>res/svg/avatar_10.svg</file>
<file>res/svg/avatar_11.svg</file>
<file>res/svg/avatar_12.svg</file>
<file>page/AboutPage.qml</file>
<file>page/MainPage.qml</file>
<file>page/LoginPage.qml</file>
<file>T_ToggleSwitch.qml</file>
<file>T_ToggleSwitch.qml</file>
<file>T_Typography.qml</file>
<file>T_Awesome.qml</file>
<file>T_Buttons.qml</file>
@ -38,5 +34,9 @@
<file>T_DatePicker.qml</file>
<file>T_MultiWindow.qml</file>
<file>T_Menu.qml</file>
<file>T_Carousel.qml</file>
<file>res/image/banner_1.jpg</file>
<file>res/image/banner_2.jpg</file>
<file>res/image/banner_3.jpg</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 298 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

View File

@ -47,6 +47,7 @@ void Fluent::registerTypes(const char *uri){
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluDatePicker.qml"),uri,major,minor,"FluDatePicker");
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluTimePicker.qml"),uri,major,minor,"FluTimePicker");
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluCarousel.qml"),uri,major,minor,"FluCarousel");
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluAutoSuggestBox.qml"),uri,major,minor,"FluAutoSuggestBox");
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluExpander.qml"),uri,major,minor,"FluExpander");
@ -91,7 +92,7 @@ void Fluent::initializeEngine(QQmlEngine *engine, const char *uri)
QFont font;
font.setFamily("Microsoft YaHei");
QGuiApplication::setFont(font);
// QQuickWindow::setTextRenderType(QQuickWindow::NativeTextRendering);
// QQuickWindow::setTextRenderType(QQuickWindow::NativeTextRendering);
#endif
QFontDatabase::addApplicationFont(":/com.zhuzichu/res/font/Segoe_Fluent_Icons.ttf");
FluApp* app = FluApp::getInstance();

View File

@ -152,6 +152,7 @@ TextField{
boundsBehavior: ListView.StopAtBounds
clip: true
currentIndex: -1
ScrollBar.vertical: FluScrollBar {}
header: Item{
width: input.width
height: visible ? 38 : 0
@ -165,7 +166,6 @@ TextField{
}
}
}
ScrollBar.vertical: ScrollBar { }
delegate:Control{
width: input.width
padding:10

View File

@ -0,0 +1,161 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import FluentUI 1.0
Item {
id:control
property bool flagXChanged: true
property int radius : 5
property int loopTime: 2000
property bool showIndicator: true
width: 400
height: 300
ListModel{
id:content_model
}
FluRectangle{
anchors.fill: parent
radius: [control.radius,control.radius,control.radius,control.radius]
FluShadow{
radius:control.radius
}
ListView{
id:list_view
anchors.fill: parent
snapMode: ListView.SnapOneItem
clip: true
boundsBehavior: ListView.StopAtBounds
model:content_model
maximumFlickVelocity: 4 * (list_view.orientation ===
Qt.Horizontal ? width : height)
delegate: Item{
width: ListView.view.width
height: ListView.view.height
property int displayIndex: {
if(index === 0)
return content_model.count-3
if(index === content_model.count-1)
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){
currentIndex = list_view.count-2
}else if(currentIndex === list_view.count-1){
currentIndex = 1
}
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)))
if(contentX>=maxX){
contentX = maxX
}
if(contentX<=minY){
contentX = minY
}
}
}
orientation : ListView.Horizontal
}
}
function setData(data){
content_model.clear()
content_model.append(data[data.length-1])
content_model.append(data)
content_model.append(data[0])
list_view.currentIndex = 1
timer_run.restart()
}
Row{
spacing: 10
anchors{
horizontalCenter: parent.horizontalCenter
bottom: parent.bottom
bottomMargin: 20
}
visible: showIndicator
Repeater{
model: list_view.count
Rectangle{
width: 8
height: 8
radius: 4
visible: {
if(index===0 || index===list_view.count-1)
return false
return true
}
layer.samples: 4
layer.enabled: true
layer.smooth: true
border.width: 1
border.color: FluColors.Grey100
color: list_view.currentIndex === index ? FluTheme.primaryColor.dark : Qt.rgba(1,1,1,0.5)
}
}
}
Timer{
id:timer_anim
interval: 250
onTriggered: {
list_view.highlightMoveDuration = 0
if(list_view.currentIndex === list_view.count-1){
list_view.currentIndex = 1
}
}
}
Timer{
id:timer_run
interval: control.loopTime
repeat: true
onTriggered: {
list_view.highlightMoveDuration = 250
list_view.currentIndex = list_view.currentIndex+1
timer_anim.start()
}
}
}

View File

@ -202,7 +202,7 @@ Rectangle {
width: 100
height: parent.height
boundsBehavior:Flickable.StopAtBounds
ScrollBar.vertical: ScrollBar { }
ScrollBar.vertical: FluScrollBar {}
model: generateYearArray(1924,2048)
clip: true
visible: showYear
@ -228,7 +228,7 @@ Rectangle {
width: showYear ? 100 : 150
height: parent.height
clip: true
ScrollBar.vertical: ScrollBar { }
ScrollBar.vertical: FluScrollBar {}
boundsBehavior:Flickable.StopAtBounds
delegate: Loader{
property var model: modelData
@ -252,7 +252,7 @@ Rectangle {
width: showYear ? 100 : 150
height: parent.height
clip: true
ScrollBar.vertical: ScrollBar { }
ScrollBar.vertical: FluScrollBar {}
Layout.alignment: Qt.AlignVCenter
boundsBehavior:Flickable.StopAtBounds
delegate: Loader{

View File

@ -135,12 +135,11 @@ Item {
}
}
Item {
id:nav_app_bar
width: parent.width
height: 38
z:999
RowLayout{
height:parent.height
spacing: 0
@ -232,7 +231,7 @@ Item {
id:layout_list
width: 300
anchors{
top: nav_app_bar.bottom
top: parent.top
bottom: parent.bottom
}
x: {
@ -264,6 +263,7 @@ Item {
Item{
id:layout_header
width: layout_list.width
y:nav_app_bar.height
height: 50
FluAutoSuggestBox{
@ -322,6 +322,8 @@ Item {
stackIndex.push(currentIndex)
}
}
ScrollBar.vertical: FluScrollBar {}
model:{
if(items){
return items.children

View File

@ -9,7 +9,7 @@ Item{
property color borderColor:"red"
property int borderWidth: 1
property bool shadow: true
default property alias contentItem: container.children
default property alias contentItem: container.data
Rectangle{
id:container

View File

@ -17,10 +17,13 @@ Item {
fontStyle: FluText.TitleLarge
}
ScrollView{
Flickable{
clip: true
width: parent.width
contentWidth: parent.width
contentHeight: container.height
boundsBehavior: Flickable.StopAtBounds
ScrollBar.vertical: ScrollBar { }
anchors{
top: text_title.bottom
bottom: parent.bottom

View File

@ -6,7 +6,7 @@ Item {
anchors.margins: -4
property color color: FluTheme.isDark ? "#FFFFFF" : "#000000"
property var radius: 4
property int radius: 4
Rectangle{
width: root.width

View File

@ -201,7 +201,7 @@ Rectangle {
width: isH ? 100 : 150
height: parent.height
boundsBehavior:Flickable.StopAtBounds
ScrollBar.vertical: ScrollBar { }
ScrollBar.vertical: FluScrollBar {}
model: isH ? generateArray(1,12) : generateArray(0,23)
clip: true
delegate: Loader{
@ -225,7 +225,7 @@ Rectangle {
height: parent.height
model: generateArray(0,59)
clip: true
ScrollBar.vertical: ScrollBar { }
ScrollBar.vertical: FluScrollBar {}
boundsBehavior:Flickable.StopAtBounds
delegate: Loader{
property var model: modelData
@ -250,7 +250,7 @@ Rectangle {
model: ["上午","下午"]
clip: true
visible: isH
ScrollBar.vertical: ScrollBar { }
ScrollBar.vertical: FluScrollBar {}
Layout.alignment: Qt.AlignVCenter
boundsBehavior:Flickable.StopAtBounds
delegate: Loader{

View File

@ -276,8 +276,8 @@ Item {
model: tree_model
flickableDirection: Flickable.HorizontalAndVerticalFlick
clip: true
ScrollBar.vertical: ScrollBar { }
ScrollBar.horizontal: ScrollBar { }
ScrollBar.vertical: FluScrollBar {}
ScrollBar.horizontal: FluScrollBar { }
}
function updateData(items){

View File

@ -47,5 +47,6 @@
<file>controls/FluCalenderView.qml</file>
<file>controls/FluCalendarDatePicker.qml</file>
<file>controls/FluFocusRectangle.qml</file>
<file>controls/FluCarousel.qml</file>
</qresource>
</RCC>