diff --git a/CMakeLists.txt b/CMakeLists.txt index 8a8f4e0..24da5a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,10 @@ -cmake_minimum_required(VERSION 3.16) +cmake_minimum_required(VERSION 3.20) project(FluentUI VERSION 0.1 LANGUAGES CXX) add_subdirectory(src) add_subdirectory(example) + +add_definitions(-DFRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT) +add_definitions(-DFRAMELESSHELPER_QUICK_NO_DEBUG_OUTPUT) add_subdirectory(framelesshelper) diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index fc3fbe7..9f281c6 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.16) +cmake_minimum_required(VERSION 3.20) project(example VERSION 0.1 LANGUAGES CXX) diff --git a/example/qml/page/T_RatingControl.qml b/example/qml/page/T_RatingControl.qml index 505394a..cf10258 100644 --- a/example/qml/page/T_RatingControl.qml +++ b/example/qml/page/T_RatingControl.qml @@ -5,36 +5,31 @@ import QtQuick.Controls import FluentUI import "../component" -FluScrollablePage{ +FluScrollablePage { - title:"RatingControl" + title: "RatingControl" - FluArea{ + FluArea { Layout.fillWidth: true height: 100 paddings: 10 Layout.topMargin: 20 - Column{ + Column { spacing: 10 anchors.verticalCenter: parent.verticalCenter - FluRatingControl{ - - } - FluRatingControl{ - number:10 + FluRatingControl {} + FluRatingControl { + number: 10 } } - } - CodeExpander{ + CodeExpander { Layout.fillWidth: true Layout.topMargin: -1 - code:'FluRatingControl{ + code: 'FluRatingControl{ }' } - - } diff --git a/example/qml/window/MainWindow.qml b/example/qml/window/MainWindow.qml index 7acbf41..cde0212 100644 --- a/example/qml/window/MainWindow.qml +++ b/example/qml/window/MainWindow.qml @@ -90,12 +90,8 @@ CustomWindow { FluNavigationView{ id:nav_view - anchors{ - top: parent.top - left: parent.left - right: parent.right - bottom: parent.bottom - } + width: parent.width + height: parent.height z:999 items: ItemsOriginal footerItems:ItemsFooter diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d929d87..2892c16 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.16) +cmake_minimum_required(VERSION 3.20) project(fluentuiplugin LANGUAGES CXX) @@ -52,6 +52,8 @@ qt_add_qml_module(fluentuiplugin OUTPUT_DIRECTORY ${QML_PLUGIN_DIRECTORY} VERSION 1.0 URI "FluentUI" + #修改qmltypes文件名称。默认fluentuiplugin.qmltypes,使用默认名称有时候import FluentUI会爆红,所以修改成plugins.qmltypes + TYPEINFO "plugins.qmltypes" SOURCES ${sources_files} fluentui.rc QML_FILES ${qml_files} RESOURCES ${resource_files} diff --git a/src/imports/FluentUI/Controls/FluNavigationView.qml b/src/imports/FluentUI/Controls/FluNavigationView.qml index b038bb4..a34553e 100644 --- a/src/imports/FluentUI/Controls/FluNavigationView.qml +++ b/src/imports/FluentUI/Controls/FluNavigationView.qml @@ -7,10 +7,10 @@ import FluentUI Item { enum DisplayMode { - Open, - Compact, - Minimal, - Auto + Open = 0, + Compact = 1, + Minimal = 2, + Auto = 3 } enum PageModeFlag{ Standard = 0, @@ -55,9 +55,7 @@ Item { collapseAll() } if(d.displayMode === FluNavigationView.Minimal){ - anim_layout_list_x.enabled = false d.enableNavigationPanel = false - timer_anim_x_enable.restart() } } function handleItems(){ @@ -202,18 +200,12 @@ Item { right: parent.right rightMargin: 12 } - opacity: { + visible: { if(d.isCompactAndNotPanel){ return false } return true } - visible:opacity - Behavior on opacity { - NumberAnimation{ - duration: 83 - } - } Behavior on rotation { NumberAnimation{ duration: 83 @@ -273,18 +265,12 @@ Item { FluText{ id:item_title text:model.title - opacity: { + visible: { if(d.isCompactAndNotPanel){ return false } return true } - visible:opacity - Behavior on opacity { - NumberAnimation{ - duration: 83 - } - } anchors{ verticalCenter: parent.verticalCenter left:item_icon.right @@ -429,18 +415,12 @@ Item { FluText{ id:item_title text:model.title - opacity: { + visible: { if(d.isCompactAndNotPanel){ return false } return true } - visible:opacity - Behavior on opacity { - NumberAnimation{ - duration: 83 - } - } color:{ if(item_control.pressed){ return FluTheme.dark ? FluColors.Grey80 : FluColors.Grey120 @@ -496,11 +476,18 @@ Item { Layout.preferredWidth: d.isMinimal ? 30 : 0 Layout.preferredHeight: 30 Layout.alignment: Qt.AlignVCenter + clip: true onClicked: { d.enableNavigationPanel = !d.enableNavigationPanel } - visible: d.isMinimal - Behavior on Layout.preferredWidth{ + visible: opacity + opacity: d.isMinimal + Behavior on opacity{ + NumberAnimation{ + duration: 83 + } + } + Behavior on Layout.preferredWidth { NumberAnimation{ duration: 167 easing.type: Easing.BezierSpline @@ -547,11 +534,26 @@ Item { } Item{ anchors{ - left: d.isMinimal || d.isCompactAndPanel ? parent.left : layout_list.right + left: parent.left top: nav_app_bar.bottom right: parent.right bottom: parent.bottom - leftMargin: d.isCompactAndPanel ? 50 : 0 + leftMargin: { + if(d.isMinimal){ + return 0 + } + if(d.isCompact){ + return 50 + } + return 300 + } + } + Behavior on anchors.leftMargin { + NumberAnimation{ + duration: 167 + easing.type: Easing.BezierSpline + easing.bezierCurve: [ 0, 0, 0, 1 ] + } } StackView{ id:nav_swipe @@ -586,11 +588,12 @@ Item { MouseArea{ anchors.fill: parent visible: d.isMinimalAndPanel||d.isCompactAndPanel + onWheel: { + } onClicked: { d.enableNavigationPanel = false } } - Rectangle{ id:layout_list width: { @@ -599,21 +602,6 @@ Item { } return 300 } - Behavior on width{ - NumberAnimation{ - duration: 167 - easing.type: Easing.BezierSpline - easing.bezierCurve: [ 0, 0, 0, 1 ] - } - } - Behavior on x{ - id:anim_layout_list_x - NumberAnimation{ - duration: 167 - easing.type: Easing.BezierSpline - easing.bezierCurve: [ 0, 0, 0, 1 ] - } - } anchors{ top: parent.top bottom: parent.bottom @@ -627,6 +615,13 @@ Item { return "transparent" } x: visible ? 0 : -width + Behavior on x { + NumberAnimation{ + duration: 167 + easing.type: Easing.BezierSpline + easing.bezierCurve: [ 0, 0, 0, 1 ] + } + } visible: { if(d.displayMode !== FluNavigationView.Minimal) return true @@ -656,27 +651,15 @@ Item { id:loader_auto_suggest_box anchors.centerIn: parent sourceComponent: autoSuggestBox - opacity: { + visible: { if(d.isCompactAndNotPanel){ return false } return true } - visible: opacity - Behavior on opacity{ - NumberAnimation{ - duration: 83 - } - } } FluIconButton{ - visible:opacity - opacity:d.isCompactAndNotPanel - Behavior on opacity{ - NumberAnimation{ - duration: 83 - } - } + visible:d.isCompactAndNotPanel hoverColor: FluTheme.dark ? Qt.rgba(1,1,1,0.03) : Qt.rgba(0,0,0,0.03) pressedColor: FluTheme.dark ? Qt.rgba(1,1,1,0.03) : Qt.rgba(0,0,0,0.03) normalColor: FluTheme.dark ? Qt.rgba(0,0,0,0) : Qt.rgba(0,0,0,0) @@ -870,13 +853,6 @@ Item { control_popup.open() } } - Timer{ - id:timer_anim_x_enable - interval: 150 - onTriggered: { - anim_layout_list_x.enabled = true - } - } function collapseAll(){ for(var i=0;i