diff --git a/example/example_en_US.ts b/example/example_en_US.ts index 05838b2a..89ca73b5 100644 --- a/example/example_en_US.ts +++ b/example/example_en_US.ts @@ -47,39 +47,39 @@ FluentInitalizrWindow - + - + FluentUI Initalizr - - + + Name - - + + Create In - - + + Browse - - + + Cancel - - + + Create @@ -102,22 +102,22 @@ InitalizrHelper - + The name cannot be empty - + The creation path cannot be empty - + The path does not exist - + %1 folder already exists diff --git a/example/example_zh_CN.ts b/example/example_zh_CN.ts index ae0df24e..5112362e 100644 --- a/example/example_zh_CN.ts +++ b/example/example_zh_CN.ts @@ -47,39 +47,39 @@ FluentInitalizrWindow - + - + FluentUI Initalizr FluentUI脚手架 - - + + Name 名称 - - + + Create In 创建路径 - - + + Browse 浏览 - - + + Cancel 取消 - - + + Create 创建 @@ -102,22 +102,22 @@ InitalizrHelper - + The name cannot be empty 名称不能为空 - + The creation path cannot be empty 创建路径不能为空 - + The path does not exist 路径不存在 - + %1 folder already exists diff --git a/example/qml-Qt6/window/FluentInitalizrWindow.qml b/example/qml-Qt6/window/FluentInitalizrWindow.qml index 5ef64459..aec5039c 100644 --- a/example/qml-Qt6/window/FluentInitalizrWindow.qml +++ b/example/qml-Qt6/window/FluentInitalizrWindow.qml @@ -60,9 +60,6 @@ FluWindow { width: 300 placeholderText: qsTr("Create In") anchors.verticalCenter: parent.verticalCenter - Component.onCompleted: { - text = FluTools.toLocalPath(StandardPaths.standardLocations(StandardPaths.DocumentsLocation)[0]) - } } FluButton{ text:qsTr("Browse") @@ -76,7 +73,6 @@ FluWindow { FolderDialog{ id:folder_dialog - folder: StandardPaths.standardLocations(StandardPaths.DocumentsLocation)[0] onAccepted: { text_box_path.text = FluTools.toLocalPath(currentFolder) } diff --git a/example/qml-Qt6/window/MainWindow.qml b/example/qml-Qt6/window/MainWindow.qml index 8b593653..07eaecb5 100644 --- a/example/qml-Qt6/window/MainWindow.qml +++ b/example/qml-Qt6/window/MainWindow.qml @@ -245,7 +245,7 @@ FluWindow { id:com_reveal CircularReveal{ id:reveal - target:window.layoutContainer() + target:window.contentItem anchors.fill: parent onAnimationFinished:{ //动画结束后释放资源 @@ -274,7 +274,7 @@ FluWindow { return } loader_reveal.sourceComponent = com_reveal - var target = window.layoutContainer() + var target = window.contentItem var pos = button.mapToItem(target,0,0) var mouseX = pos.x var mouseY = pos.y diff --git a/example/qml/window/FluentInitalizrWindow.qml b/example/qml/window/FluentInitalizrWindow.qml index f17330d6..0364822c 100644 --- a/example/qml/window/FluentInitalizrWindow.qml +++ b/example/qml/window/FluentInitalizrWindow.qml @@ -60,9 +60,6 @@ FluWindow { width: 300 placeholderText: qsTr("Create In") anchors.verticalCenter: parent.verticalCenter - Component.onCompleted: { - text = FluTools.toLocalPath(StandardPaths.standardLocations(StandardPaths.DocumentsLocation)[0]) - } } FluButton{ text:qsTr("Browse") @@ -76,7 +73,6 @@ FluWindow { FolderDialog{ id:folder_dialog - folder: StandardPaths.standardLocations(StandardPaths.DocumentsLocation)[0] onAccepted: { text_box_path.text = FluTools.toLocalPath(currentFolder) } diff --git a/example/qml/window/MainWindow.qml b/example/qml/window/MainWindow.qml index 56a2cb22..26d040c8 100644 --- a/example/qml/window/MainWindow.qml +++ b/example/qml/window/MainWindow.qml @@ -242,10 +242,10 @@ FluWindow { } Component{ - id:com_reveal + id: com_reveal CircularReveal{ - id:reveal - target:window.layoutContainer() + id: reveal + target: window.contentItem anchors.fill: parent onAnimationFinished:{ //动画结束后释放资源 @@ -274,7 +274,7 @@ FluWindow { return } loader_reveal.sourceComponent = com_reveal - var target = window.layoutContainer() + var target = window.contentItem var pos = button.mapToItem(target,0,0) var mouseX = pos.x var mouseY = pos.y diff --git a/example/src/helper/TranslateHelper.cpp b/example/src/helper/TranslateHelper.cpp index 7376bf20..178b9416 100644 --- a/example/src/helper/TranslateHelper.cpp +++ b/example/src/helper/TranslateHelper.cpp @@ -19,6 +19,7 @@ void TranslateHelper::init(QQmlEngine* engine){ _translator = new QTranslator(this); qApp->installTranslator(_translator); QString translatorPath = QGuiApplication::applicationDirPath()+"/i18n"; - _translator->load(QString::fromStdString("%1/example_%2.qm").arg(translatorPath,_current)); - _engine->retranslate(); + if(_translator->load(QString::fromStdString("%1/example_%2.qm").arg(translatorPath,_current))){ + _engine->retranslate(); + } } diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a80bcc93..3d35c542 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -13,7 +13,7 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) #设置版本号 -add_definitions(-DFLUENTUI_VERSION=1,6,9,0) +add_definitions(-DFLUENTUI_VERSION=1,7,0,0) if (FLUENTUI_BUILD_STATIC_LIB) add_definitions(-DFLUENTUI_BUILD_STATIC_LIB) diff --git a/src/Qt5/imports/FluentUI/Controls/FluArea.qml b/src/Qt5/imports/FluentUI/Controls/FluArea.qml index 3c826d39..4e75236a 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluArea.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluArea.qml @@ -4,12 +4,13 @@ import QtQuick.Window 2.15 import FluentUI 1.0 Rectangle { - default property alias content: container.data + default property list contentData property int paddings : 0 property int leftPadding : 0 property int rightPadding : 0 property int topPadding : 0 property int bottomPadding : 0 + id:control radius: 4 color: FluTheme.dark ? Window.active ? Qt.rgba(38/255,44/255,54/255,1) : Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1) border.color: FluTheme.dark ? Window.active ? Qt.rgba(55/255,55/255,55/255,1):Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1) @@ -17,7 +18,7 @@ Rectangle { implicitHeight: height implicitWidth: width Item { - id: container + data: control.contentData anchors.fill: parent anchors.leftMargin: Math.max(paddings,leftPadding) anchors.rightMargin: Math.max(paddings,rightPadding) diff --git a/src/Qt5/imports/FluentUI/Controls/FluDivider.qml b/src/Qt5/imports/FluentUI/Controls/FluDivider.qml index 9ad272bd..4bd4b2e0 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluDivider.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluDivider.qml @@ -2,26 +2,33 @@ import QtQuick 2.15 import QtQuick.Window 2.15 import FluentUI 1.0 - Item { id:control property int orientation: Qt.Horizontal property int spacing:0 property int size: 1 - QtObject{ id:d property bool isVertical : orientation === Qt.Vertical + property int parentHeight: { + if(control.parent){ + return control.parent.height + } + return control.height + } + property int parentWidth: { + if(control.parent){ + return control.parent.width + } + return control.width + } } - - width: d.isVertical ? spacing*2+size : parent.width - height: d.isVertical ? parent.height : spacing*2+size - + width: d.isVertical ? spacing*2+size : d.parentWidth + height: d.isVertical ? d.parentHeight : spacing*2+size FluRectangle{ color: FluTheme.dividerColor - width: d.isVertical ? size : parent.width - height: d.isVertical ? parent.height : size + width: d.isVertical ? size : d.parentWidth + height: d.isVertical ? d.parentHeight : size anchors.centerIn: parent } - } diff --git a/src/Qt5/imports/FluentUI/Controls/FluIcon.qml b/src/Qt5/imports/FluentUI/Controls/FluIcon.qml index 3a51b3f2..753bcd5f 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluIcon.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluIcon.qml @@ -13,7 +13,4 @@ Text { verticalAlignment: Text.AlignVCenter color: iconColor text: (String.fromCharCode(iconSource).toString(16)) - FontLoader{ - source: "../Font/Segoe_Fluent_Icons.ttf" - } } diff --git a/src/Qt5/imports/FluentUI/Controls/FluPopup.qml b/src/Qt5/imports/FluentUI/Controls/FluPopup.qml index 8d65693d..8db2098a 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluPopup.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluPopup.qml @@ -5,12 +5,12 @@ import QtQuick.Window 2.15 import FluentUI 1.0 Popup { - id: popup + id: control padding: 0 modal:true parent: Overlay.overlay - x: Math.round((parent.width - width) / 2) - y: Math.round((parent.height - height) / 2) + x: Math.round((d.parentWidth - width) / 2) + y: Math.round((d.parentHeight - height) / 2) closePolicy: Popup.CloseOnEscape enter: Transition { NumberAnimation { @@ -20,7 +20,7 @@ Popup { to:1 } } - height:Math.min(implicitHeight,parent.height) + height:Math.min(implicitHeight,d.parentHeight) exit:Transition { NumberAnimation { property: "opacity" @@ -36,5 +36,19 @@ Popup { radius: 5 } } + QtObject{ + id:d + property int parentHeight: { + if(control.parent){ + return control.parent.height + } + return control.height + } + property int parentWidth: { + if(control.parent){ + return control.parent.width + } + return control.width + } + } } - diff --git a/src/Qt5/imports/FluentUI/Controls/FluRadioButtons.qml b/src/Qt5/imports/FluentUI/Controls/FluRadioButtons.qml index 84b41a5b..83060795 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluRadioButtons.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluRadioButtons.qml @@ -11,7 +11,10 @@ ColumnLayout { for(var i = 0;icontrol.height) - return d.pos.y-height-control.targetMargins - 15 - return ty + if(d.target){ + var ty=d.pos.y+d.target.height+control.targetMargins + 15 + if((ty+height)>control.height) + return d.pos.y-height-control.targetMargins - 15 + return ty + } + return 0 } border.width: 0 FluShadow{ radius: 5 } FluText{ - text: d.step.title + text: { + if(d.step){ + return d.step.title + } + return "" + } font: FluTextStyle.BodyStrong elide: Text.ElideRight anchors{ @@ -148,7 +178,12 @@ Popup{ wrapMode: Text.WrapAnywhere maximumLineCount: 4 elide: Text.ElideRight - text: d.step.description + text: { + if(d.step){ + return d.step.description + } + return "" + } anchors{ top: parent.top left: parent.left @@ -199,7 +234,17 @@ Popup{ FluIcon{ iconSource: layout_panne.dir?FluentIcons.FlickUp:FluentIcons.FlickDown color: layout_panne.color - x: d.pos.x+d.target.width/2-10 - y: d.pos.y+(layout_panne.dir?-height:d.target.height) + x: { + if(d.target){ + return d.pos.x+d.target.width/2-10 + } + return 0 + } + y: { + if(d.target){ + return d.pos.y+(layout_panne.dir?-height:d.target.height) + } + return 0 + } } } diff --git a/src/Qt5/imports/FluentUI/Controls/FluWindow.qml b/src/Qt5/imports/FluentUI/Controls/FluWindow.qml index b0acb40c..36b0248b 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluWindow.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluWindow.qml @@ -5,7 +5,7 @@ import QtQuick.Layouts 1.15 import FluentUI 1.0 Window { - default property alias content: layout_content.data + default property list contentData property string windowIcon: FluApp.windowIcon property int launchMode: FluWindowType.Standard property var argument:({}) @@ -101,6 +101,9 @@ Window { } lifecycle.onVisible(visible) } + onWidthChanged: { + window.appBar.width = width + } QtObject{ id:d property bool isFirstVisible: true @@ -204,71 +207,62 @@ Window { FluLoader{ id:loader_frameless_helper } + FluLoader{ + anchors.fill: parent + sourceComponent: background + } + FluLoader{ + id:loader_app_bar + anchors { + top: parent.top + left: parent.left + right: parent.right + } + height: { + if(window.useSystemAppBar){ + return 0 + } + return window.fitsAppBarWindows ? 0 : window.appBar.height + } + sourceComponent: window.useSystemAppBar ? undefined : com_app_bar + } Item{ - id:layout_container + data: window.contentData anchors{ - fill:parent + top: loader_app_bar.bottom + left: parent.left + right: parent.right + bottom: parent.bottom } - onWidthChanged: { - window.appBar.width = width - } - FluLoader{ - anchors.fill: parent - sourceComponent: background - } - FluLoader{ - id:loader_app_bar - anchors { - top: parent.top - left: parent.left - right: parent.right + clip: true + } + FluLoader{ + property string loadingText: "加载中..." + property bool cancel: false + id:loader_loading + anchors.fill: parent + } + FluInfoBar{ + id:infoBar + root: window + } + FluWindowLifecycle{ + id:lifecycle + } + FluLoader{ + id:loader_border + anchors.fill: parent + sourceComponent: { + if(window.useSystemAppBar){ + return undefined } - height: { - if(window.useSystemAppBar){ - return 0 - } - return window.fitsAppBarWindows ? 0 : window.appBar.height + if(FluTools.isWindows10OrGreater()){ + return undefined } - sourceComponent: window.useSystemAppBar ? undefined : com_app_bar - } - Item{ - id:layout_content - anchors{ - top: loader_app_bar.bottom - left: parent.left - right: parent.right - bottom: parent.bottom - } - clip: true - } - FluLoader{ - property string loadingText: "加载中..." - property bool cancel: false - id:loader_loading - anchors.fill: layout_content - } - FluInfoBar{ - id:infoBar - root: window - } - FluWindowLifecycle{ - id:lifecycle - } - FluLoader{ - id:loader_border - anchors.fill: parent - sourceComponent: { - if(window.useSystemAppBar){ - return undefined - } - if(FluTools.isWindows10OrGreater()){ - return undefined - } - if(window.visibility === Window.Maximized || window.visibility === Window.FullScreen){ - return undefined - } - return com_border + if(window.visibility === Window.Maximized || window.visibility === Window.FullScreen){ + return undefined } + return com_border } } function destoryOnClose(){ @@ -315,12 +309,6 @@ Window { _windowRegister.onResult(data) } } - function layoutContainer(){ - return layout_container - } - function layoutContent(){ - return layout_content - } function showMaximized(){ if(FluTools.isWin()){ if(loader_frameless_helper.item){ diff --git a/src/Qt5/imports/FluentUI/plugins.qmltypes b/src/Qt5/imports/FluentUI/plugins.qmltypes index 07a83c6b..b3d96a22 100644 --- a/src/Qt5/imports/FluentUI/plugins.qmltypes +++ b/src/Qt5/imports/FluentUI/plugins.qmltypes @@ -8,6 +8,19 @@ import QtQuick.tooling 1.2 Module { dependencies: ["QtQuick 2.0"] + Component { + name: "FluAccentColor" + prototype: "QObject" + exports: ["FluentUI/FluAccentColor 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "darkest"; type: "QColor" } + Property { name: "darker"; type: "QColor" } + Property { name: "dark"; type: "QColor" } + Property { name: "normal"; type: "QColor" } + Property { name: "light"; type: "QColor" } + Property { name: "lighter"; type: "QColor" } + Property { name: "lightest"; type: "QColor" } + } Component { name: "FluCalendarViewType" exports: ["FluentUI/FluCalendarViewType 1.0"] @@ -37,19 +50,6 @@ Module { Parameter { name: "code"; type: "string" } } } - Component { - name: "FluColorSet" - prototype: "QObject" - exports: ["FluentUI/FluColorSet 1.0"] - exportMetaObjectRevisions: [0] - Property { name: "darkest"; type: "string" } - Property { name: "darker"; type: "string" } - Property { name: "dark"; type: "string" } - Property { name: "normal"; type: "string" } - Property { name: "light"; type: "string" } - Property { name: "lighter"; type: "string" } - Property { name: "lightest"; type: "string" } - } Component { name: "FluContentDialogType" exports: ["FluentUI/FluContentDialogType 1.0"] @@ -85,6 +85,7 @@ Module { name: "showSystemMenu" Parameter { name: "point"; type: "QPoint" } } + Method { name: "showMaximized" } } Component { name: "FluNavigationViewType" @@ -2380,7 +2381,7 @@ Module { } Property { name: "buttonDark" - type: "FluToggleSwitch_QMLTYPE_21" + type: "FluToggleSwitch_QMLTYPE_22" isReadonly: true isPointer: true } @@ -2398,13 +2399,13 @@ Module { exports: ["FluentUI/FluArea 1.0"] exportMetaObjectRevisions: [0] isComposite: true - defaultProperty: "content" + defaultProperty: "contentData" + Property { name: "contentData"; type: "QObject"; isList: true; isReadonly: true } Property { name: "paddings"; type: "int" } Property { name: "leftPadding"; type: "int" } Property { name: "rightPadding"; type: "int" } Property { name: "topPadding"; type: "int" } Property { name: "bottomPadding"; type: "int" } - Property { name: "content"; type: "QObject"; isList: true; isReadonly: true } } Component { prototype: "QQuickTextField" @@ -2650,6 +2651,14 @@ Module { defaultProperty: "data" Property { name: "current"; type: "QColor" } Property { name: "colorHandleRadius"; type: "int" } + Property { name: "cancelText"; type: "string" } + Property { name: "okText"; type: "string" } + Property { name: "titleText"; type: "string" } + Property { name: "editText"; type: "string" } + Property { name: "redText"; type: "string" } + Property { name: "greenText"; type: "string" } + Property { name: "blueText"; type: "string" } + Property { name: "opacityText"; type: "string" } Signal { name: "accepted" } } Component { @@ -2748,6 +2757,11 @@ Module { Property { name: "normalColor"; type: "QColor" } Property { name: "showYear"; type: "bool" } Property { name: "current"; type: "QVariant" } + Property { name: "yearText"; type: "string" } + Property { name: "monthText"; type: "string" } + Property { name: "dayText"; type: "string" } + Property { name: "cancelText"; type: "string" } + Property { name: "okText"; type: "string" } Signal { name: "accepted" } Method { name: "generateYearArray" @@ -3038,15 +3052,15 @@ Module { defaultProperty: "data" Property { name: "logo"; type: "QUrl" } Property { name: "title"; type: "string" } - Property { name: "items"; type: "FluObject_QMLTYPE_156"; isPointer: true } - Property { name: "footerItems"; type: "FluObject_QMLTYPE_156"; isPointer: true } + Property { name: "items"; type: "FluObject_QMLTYPE_157"; isPointer: true } + Property { name: "footerItems"; type: "FluObject_QMLTYPE_157"; isPointer: true } Property { name: "displayMode"; type: "int" } Property { name: "autoSuggestBox"; type: "QQmlComponent"; isPointer: true } Property { name: "actionItem"; type: "QQmlComponent"; isPointer: true } Property { name: "topPadding"; type: "int" } Property { name: "pageMode"; type: "int" } - Property { name: "navItemRightMenu"; type: "FluMenu_QMLTYPE_33"; isPointer: true } - Property { name: "navItemExpanderRightMenu"; type: "FluMenu_QMLTYPE_33"; isPointer: true } + Property { name: "navItemRightMenu"; type: "FluMenu_QMLTYPE_47"; isPointer: true } + Property { name: "navItemExpanderRightMenu"; type: "FluMenu_QMLTYPE_47"; isPointer: true } Property { name: "navCompactWidth"; type: "int" } Property { name: "navTopMargin"; type: "int" } Property { name: "cellHeight"; type: "int" } @@ -3735,6 +3749,12 @@ Module { Property { name: "hourFormat"; type: "int" } Property { name: "isH"; type: "int" } Property { name: "current"; type: "QVariant" } + Property { name: "amText"; type: "string" } + Property { name: "pmText"; type: "string" } + Property { name: "hourText"; type: "string" } + Property { name: "minuteText"; type: "string" } + Property { name: "cancelText"; type: "string" } + Property { name: "okText"; type: "string" } Signal { name: "accepted" } Method { name: "generateArray" @@ -3813,6 +3833,9 @@ Module { Property { name: "nextButton"; type: "QQmlComponent"; isPointer: true } Property { name: "prevButton"; type: "QQmlComponent"; isPointer: true } Property { name: "index"; type: "int" } + Property { name: "finishText"; type: "string" } + Property { name: "nextText"; type: "string" } + Property { name: "previousText"; type: "string" } } Component { prototype: "QQuickItem" @@ -3851,9 +3874,9 @@ Module { exports: ["FluentUI/FluWindow 1.0"] exportMetaObjectRevisions: [0] isComposite: true - defaultProperty: "content" + defaultProperty: "contentData" + Property { name: "contentData"; type: "QObject"; isList: true; isReadonly: true } Property { name: "windowIcon"; type: "string" } - Property { name: "closeDestory"; type: "bool" } Property { name: "launchMode"; type: "int" } Property { name: "argument"; type: "QVariant" } Property { name: "background"; type: "QVariant" } @@ -3871,18 +3894,16 @@ Module { Property { name: "autoMaximize"; type: "bool" } Property { name: "autoVisible"; type: "bool" } Property { name: "autoCenter"; type: "bool" } + Property { name: "autoDestory"; type: "bool" } Property { name: "useSystemAppBar"; type: "bool" } Property { name: "resizeBorderColor"; type: "QColor" } Property { name: "resizeBorderWidth"; type: "int" } Property { name: "closeListener"; type: "QVariant" } - Property { name: "_offsetXY"; type: "QPointF" } - Property { name: "_originalPos"; type: "QVariant" } Property { name: "_realHeight"; type: "int" } Property { name: "_realWidth"; type: "int" } Property { name: "_appBarHeight"; type: "int" } Property { name: "_windowRegister"; type: "QVariant" } Property { name: "_route"; type: "string" } - Property { name: "content"; type: "QObject"; isList: true; isReadonly: true } Signal { name: "showSystemMenu" } Signal { name: "initArgument" @@ -3937,7 +3958,6 @@ Module { type: "QVariant" Parameter { name: "data"; type: "QVariant" } } - Method { name: "layoutContainer"; type: "QVariant" } - Method { name: "layoutContent"; type: "QVariant" } + Method { name: "showMaximized"; type: "QVariant" } } } diff --git a/src/Qt6/imports/FluentUI/Controls/FluArea.qml b/src/Qt6/imports/FluentUI/Controls/FluArea.qml index 99a35b39..f4708f3e 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluArea.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluArea.qml @@ -4,12 +4,13 @@ import QtQuick.Window import FluentUI Rectangle { - default property alias content: container.data + default property list contentData property int paddings : 0 property int leftPadding : 0 property int rightPadding : 0 property int topPadding : 0 property int bottomPadding : 0 + id:control radius: 4 color: FluTheme.dark ? Window.active ? Qt.rgba(38/255,44/255,54/255,1) : Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1) border.color: FluTheme.dark ? Window.active ? Qt.rgba(55/255,55/255,55/255,1):Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1) @@ -17,7 +18,7 @@ Rectangle { implicitHeight: height implicitWidth: width Item { - id: container + data: control.contentData anchors.fill: parent anchors.leftMargin: Math.max(paddings,leftPadding) anchors.rightMargin: Math.max(paddings,rightPadding) diff --git a/src/Qt6/imports/FluentUI/Controls/FluDivider.qml b/src/Qt6/imports/FluentUI/Controls/FluDivider.qml index ad576908..e7b48bef 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluDivider.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluDivider.qml @@ -7,20 +7,28 @@ Item { property int orientation: Qt.Horizontal property int spacing:0 property int size: 1 - QtObject{ id:d property bool isVertical : orientation === Qt.Vertical + property int parentHeight: { + if(control.parent){ + return control.parent.height + } + return control.height + } + property int parentWidth: { + if(control.parent){ + return control.parent.width + } + return control.width + } } - - width: d.isVertical ? spacing*2+size : parent.width - height: d.isVertical ? parent.height : spacing*2+size - + width: d.isVertical ? spacing*2+size : d.parentWidth + height: d.isVertical ? d.parentHeight : spacing*2+size FluRectangle{ color: FluTheme.dividerColor - width: d.isVertical ? size : parent.width - height: d.isVertical ? parent.height : size + width: d.isVertical ? size : d.parentWidth + height: d.isVertical ? d.parentHeight : size anchors.centerIn: parent } - } diff --git a/src/Qt6/imports/FluentUI/Controls/FluIcon.qml b/src/Qt6/imports/FluentUI/Controls/FluIcon.qml index edf17b61..24600109 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluIcon.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluIcon.qml @@ -13,7 +13,4 @@ Text { verticalAlignment: Text.AlignVCenter color: iconColor text: (String.fromCharCode(iconSource).toString(16)) - FontLoader{ - source: "../Font/Segoe_Fluent_Icons.ttf" - } } diff --git a/src/Qt6/imports/FluentUI/Controls/FluPopup.qml b/src/Qt6/imports/FluentUI/Controls/FluPopup.qml index 396c8f31..78d9d5bb 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluPopup.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluPopup.qml @@ -5,12 +5,12 @@ import QtQuick.Window import FluentUI Popup { - id: popup + id: control padding: 0 modal:true parent: Overlay.overlay - x: Math.round((parent.width - width) / 2) - y: Math.round((parent.height - height) / 2) + x: Math.round((d.parentWidth - width) / 2) + y: Math.round((d.parentHeight - height) / 2) closePolicy: Popup.CloseOnEscape enter: Transition { NumberAnimation { @@ -20,7 +20,7 @@ Popup { to:1 } } - height:Math.min(implicitHeight,parent.height) + height:Math.min(implicitHeight,d.parentHeight) exit:Transition { NumberAnimation { property: "opacity" @@ -36,4 +36,19 @@ Popup { radius: 5 } } + QtObject{ + id:d + property int parentHeight: { + if(control.parent){ + return control.parent.height + } + return control.height + } + property int parentWidth: { + if(control.parent){ + return control.parent.width + } + return control.width + } + } } diff --git a/src/Qt6/imports/FluentUI/Controls/FluRadioButtons.qml b/src/Qt6/imports/FluentUI/Controls/FluRadioButtons.qml index 9a5e908b..eb8c817d 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluRadioButtons.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluRadioButtons.qml @@ -12,7 +12,10 @@ ColumnLayout { for(var i = 0;icontrol.height) - return d.pos.y-height-control.targetMargins - 15 - return ty + if(d.target){ + var ty=d.pos.y+d.target.height+control.targetMargins + 15 + if((ty+height)>control.height) + return d.pos.y-height-control.targetMargins - 15 + return ty + } + return 0 } border.width: 0 FluShadow{ radius: 5 } FluText{ - text: d.step.title + text: { + if(d.step){ + return d.step.title + } + return "" + } font: FluTextStyle.BodyStrong elide: Text.ElideRight anchors{ @@ -148,7 +178,12 @@ Popup{ wrapMode: Text.WrapAnywhere maximumLineCount: 4 elide: Text.ElideRight - text: d.step.description + text: { + if(d.step){ + return d.step.description + } + return "" + } anchors{ top: parent.top left: parent.left @@ -199,7 +234,17 @@ Popup{ FluIcon{ iconSource: layout_panne.dir?FluentIcons.FlickUp:FluentIcons.FlickDown color: layout_panne.color - x: d.pos.x+d.target.width/2-10 - y: d.pos.y+(layout_panne.dir?-height:d.target.height) + x: { + if(d.target){ + return d.pos.x+d.target.width/2-10 + } + return 0 + } + y: { + if(d.target){ + return d.pos.y+(layout_panne.dir?-height:d.target.height) + } + return 0 + } } } diff --git a/src/Qt6/imports/FluentUI/Controls/FluWindow.qml b/src/Qt6/imports/FluentUI/Controls/FluWindow.qml index 0ad01a96..8da4ac64 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluWindow.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluWindow.qml @@ -4,7 +4,7 @@ import QtQuick.Layouts import FluentUI Window { - default property alias content: layout_content.data + default property list contentData property string windowIcon: FluApp.windowIcon property int launchMode: FluWindowType.Standard property var argument:({}) @@ -100,6 +100,9 @@ Window { } lifecycle.onVisible(visible) } + onWidthChanged: { + window.appBar.width = width + } QtObject{ id:d property bool isFirstVisible: true @@ -203,71 +206,62 @@ Window { FluLoader{ id:loader_frameless_helper } + FluLoader{ + anchors.fill: parent + sourceComponent: background + } + FluLoader{ + id:loader_app_bar + anchors { + top: parent.top + left: parent.left + right: parent.right + } + height: { + if(window.useSystemAppBar){ + return 0 + } + return window.fitsAppBarWindows ? 0 : window.appBar.height + } + sourceComponent: window.useSystemAppBar ? undefined : com_app_bar + } Item{ - id:layout_container + data: window.contentData anchors{ - fill:parent + top: loader_app_bar.bottom + left: parent.left + right: parent.right + bottom: parent.bottom } - onWidthChanged: { - window.appBar.width = width - } - FluLoader{ - anchors.fill: parent - sourceComponent: background - } - FluLoader{ - id:loader_app_bar - anchors { - top: parent.top - left: parent.left - right: parent.right + clip: true + } + FluLoader{ + property string loadingText: "加载中..." + property bool cancel: false + id:loader_loading + anchors.fill: parent + } + FluInfoBar{ + id:infoBar + root: window + } + FluWindowLifecycle{ + id:lifecycle + } + FluLoader{ + id:loader_border + anchors.fill: parent + sourceComponent: { + if(window.useSystemAppBar){ + return undefined } - height: { - if(window.useSystemAppBar){ - return 0 - } - return window.fitsAppBarWindows ? 0 : window.appBar.height + if(FluTools.isWindows10OrGreater()){ + return undefined } - sourceComponent: window.useSystemAppBar ? undefined : com_app_bar - } - Item{ - id:layout_content - anchors{ - top: loader_app_bar.bottom - left: parent.left - right: parent.right - bottom: parent.bottom - } - clip: true - } - FluLoader{ - property string loadingText: "加载中..." - property bool cancel: false - id:loader_loading - anchors.fill: layout_content - } - FluInfoBar{ - id:infoBar - root: window - } - FluWindowLifecycle{ - id:lifecycle - } - FluLoader{ - id:loader_border - anchors.fill: parent - sourceComponent: { - if(window.useSystemAppBar){ - return undefined - } - if(FluTools.isWindows10OrGreater()){ - return undefined - } - if(window.visibility === Window.Maximized || window.visibility === Window.FullScreen){ - return undefined - } - return com_border + if(window.visibility === Window.Maximized || window.visibility === Window.FullScreen){ + return undefined } + return com_border } } function destoryOnClose(){ @@ -314,12 +308,6 @@ Window { _windowRegister.onResult(data) } } - function layoutContainer(){ - return layout_container - } - function layoutContent(){ - return layout_content - } function showMaximized(){ if(FluTools.isWin()){ if(loader_frameless_helper.item){