diff --git a/example/T_Carousel.qml b/example/T_Carousel.qml new file mode 100644 index 0000000..29a2070 --- /dev/null +++ b/example/T_Carousel.qml @@ -0,0 +1,15 @@ +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" + + FluCarousel{ + + } +} diff --git a/example/page/MainPage.qml b/example/page/MainPage.qml index 9a2e700..f379438 100644 --- a/example/page/MainPage.qml +++ b/example/page/MainPage.qml @@ -97,12 +97,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:{ diff --git a/example/qml.qrc b/example/qml.qrc index 81fcf5e..bec7fae 100644 --- a/example/qml.qrc +++ b/example/qml.qrc @@ -1,8 +1,6 @@ - App.qml - res/image/image_huoyin.webp res/svg/avatar_1.svg res/svg/avatar_2.svg @@ -16,12 +14,10 @@ res/svg/avatar_10.svg res/svg/avatar_11.svg res/svg/avatar_12.svg - page/AboutPage.qml page/MainPage.qml page/LoginPage.qml - - T_ToggleSwitch.qml + T_ToggleSwitch.qml T_Typography.qml T_Awesome.qml T_Buttons.qml @@ -38,5 +34,6 @@ T_DatePicker.qml T_MultiWindow.qml T_Menu.qml + T_Carousel.qml diff --git a/src/Fluent.cpp b/src/Fluent.cpp index 59c807e..386bcf7 100644 --- a/src/Fluent.cpp +++ b/src/Fluent.cpp @@ -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(); diff --git a/src/controls/FluAutoSuggestBox.qml b/src/controls/FluAutoSuggestBox.qml index 3c25edd..8704f84 100644 --- a/src/controls/FluAutoSuggestBox.qml +++ b/src/controls/FluAutoSuggestBox.qml @@ -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 diff --git a/src/controls/FluCarousel.qml b/src/controls/FluCarousel.qml new file mode 100644 index 0000000..02909d4 --- /dev/null +++ b/src/controls/FluCarousel.qml @@ -0,0 +1,7 @@ +import QtQuick 2.15 + +Item { + + + +} diff --git a/src/controls/FluDatePicker.qml b/src/controls/FluDatePicker.qml index 36895c5..b08aa44 100644 --- a/src/controls/FluDatePicker.qml +++ b/src/controls/FluDatePicker.qml @@ -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{ diff --git a/src/controls/FluNavigationView.qml b/src/controls/FluNavigationView.qml index 0aca9f7..60c4680 100644 --- a/src/controls/FluNavigationView.qml +++ b/src/controls/FluNavigationView.qml @@ -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 diff --git a/src/controls/FluScrollablePage.qml b/src/controls/FluScrollablePage.qml index a3aa02d..37ca60e 100644 --- a/src/controls/FluScrollablePage.qml +++ b/src/controls/FluScrollablePage.qml @@ -17,10 +17,12 @@ Item { fontStyle: FluText.TitleLarge } - ScrollView{ + Flickable{ clip: true width: parent.width contentWidth: parent.width + contentHeight: container.height + ScrollBar.vertical: ScrollBar { } anchors{ top: text_title.bottom bottom: parent.bottom diff --git a/src/controls/FluTimePicker.qml b/src/controls/FluTimePicker.qml index deec95e..cba7053 100644 --- a/src/controls/FluTimePicker.qml +++ b/src/controls/FluTimePicker.qml @@ -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{ diff --git a/src/controls/FluTreeView.qml b/src/controls/FluTreeView.qml index 667baf5..aa25e02 100644 --- a/src/controls/FluTreeView.qml +++ b/src/controls/FluTreeView.qml @@ -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){ diff --git a/src/res.qrc b/src/res.qrc index 91576ea..da22a17 100644 --- a/src/res.qrc +++ b/src/res.qrc @@ -47,5 +47,6 @@ controls/FluCalenderView.qml controls/FluCalendarDatePicker.qml controls/FluFocusRectangle.qml + controls/FluCarousel.qml