diff --git a/example/qml-Qt6/page/T_Theme.qml b/example/qml-Qt6/page/T_Theme.qml index 78380bd8..3a70f31f 100644 --- a/example/qml-Qt6/page/T_Theme.qml +++ b/example/qml-Qt6/page/T_Theme.qml @@ -35,7 +35,7 @@ FluScrollablePage{ height: 42 radius: 4 color: mouse_item.containsMouse ? Qt.lighter(modelData.normal,1.1) : modelData.normal - border.color: modelData.darkest + border.color: modelData.darker FluIcon { anchors.centerIn: parent iconSource: FluentIcons.AcceptMedium diff --git a/example/qml-Qt6/window/MainWindow.qml b/example/qml-Qt6/window/MainWindow.qml index 07eaecb5..5675b006 100644 --- a/example/qml-Qt6/window/MainWindow.qml +++ b/example/qml-Qt6/window/MainWindow.qml @@ -21,7 +21,6 @@ FluWindow { fitsAppBarWindows: true appBar: FluAppBar { height: 30 - darkText: qsTr("Dark Mode") showDark: true darkClickListener:(button)=>handleDarkChanged(button) closeClickListener: ()=>{dialog_close.open()} diff --git a/example/qml/page/T_Theme.qml b/example/qml/page/T_Theme.qml index fa4f24f8..dac999b4 100644 --- a/example/qml/page/T_Theme.qml +++ b/example/qml/page/T_Theme.qml @@ -35,7 +35,7 @@ FluScrollablePage{ height: 42 radius: 4 color: mouse_item.containsMouse ? Qt.lighter(modelData.normal,1.1) : modelData.normal - border.color: modelData.darkest + border.color: modelData.darker FluIcon { anchors.centerIn: parent iconSource: FluentIcons.AcceptMedium diff --git a/example/qml/window/MainWindow.qml b/example/qml/window/MainWindow.qml index 26d040c8..4b49563a 100644 --- a/example/qml/window/MainWindow.qml +++ b/example/qml/window/MainWindow.qml @@ -21,7 +21,6 @@ FluWindow { fitsAppBarWindows: true appBar: FluAppBar { height: 30 - darkText: qsTr("Dark Mode") showDark: true darkClickListener:(button)=>handleDarkChanged(button) closeClickListener: ()=>{dialog_close.open()} diff --git a/src/FluFramelessHelper.cpp b/src/FluFramelessHelper.cpp index f061ff5b..bbea1621 100644 --- a/src/FluFramelessHelper.cpp +++ b/src/FluFramelessHelper.cpp @@ -182,6 +182,7 @@ bool FramelessEventFilter::nativeEventFilter(const QByteArray &eventType, void * minmaxInfo->ptMaxSize.x = geometry.width()*pixelRatio + offsetXY.x() * 2; minmaxInfo->ptMaxSize.y = geometry.height()*pixelRatio + offsetXY.y() * 2; #endif + return false; }else if(uMsg == WM_NCRBUTTONDOWN){ if (wParam == HTCAPTION) { _helper->showSystemMenu(QCursor::pos()); diff --git a/src/FluTools.cpp b/src/FluTools.cpp index e14e18f4..f468836c 100644 --- a/src/FluTools.cpp +++ b/src/FluTools.cpp @@ -241,6 +241,6 @@ bool FluTools::isWindows10OrGreater(){ } } -int FluTools::getTaskBarHeight(QQuickWindow* window){ - return window->screen()->geometry().height() - window->screen()->availableGeometry().height(); +QRect FluTools::desktopAvailableGeometry(QQuickWindow* window){ + return window->screen()->availableGeometry(); } diff --git a/src/FluTools.h b/src/FluTools.h index dbf99aca..6dccbd3c 100644 --- a/src/FluTools.h +++ b/src/FluTools.h @@ -55,7 +55,7 @@ public: Q_INVOKABLE int windowBuildNumber(); Q_INVOKABLE bool isWindows11OrGreater(); Q_INVOKABLE bool isWindows10OrGreater(); - Q_INVOKABLE int getTaskBarHeight(QQuickWindow* window); + Q_INVOKABLE QRect desktopAvailableGeometry(QQuickWindow* window); }; #endif // FLUTOOLS_H diff --git a/src/Qt5/imports/FluentUI/Controls/FluAppBar.qml b/src/Qt5/imports/FluentUI/Controls/FluAppBar.qml index 6ca7665e..7bcf8e99 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluAppBar.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluAppBar.qml @@ -6,7 +6,8 @@ import FluentUI 1.0 Rectangle{ property string title: "" - property string darkText : "夜间模式" + property string darkText : "深色" + property string lightText : "浅色" property string minimizeText : "最小化" property string restoreText : "向下还原" property string maximizeText : "最大化" @@ -199,24 +200,33 @@ Rectangle{ Component.onCompleted: { setHitTestVisible(layout_row) } - FluToggleSwitch{ + FluIconButton{ id:btn_dark + Layout.preferredWidth: 40 + Layout.preferredHeight: 30 + padding: 0 + verticalPadding: 0 + horizontalPadding: 0 + rightPadding: 2 + iconSource: FluTheme.dark ? FluentIcons.Brightness : FluentIcons.QuietHours Layout.alignment: Qt.AlignVCenter - Layout.rightMargin: 5 + iconSize: 15 visible: showDark - text:darkText - textColor:control.textColor - checked: FluTheme.dark - textRight: false - clickListener:()=> darkClickListener(btn_dark) + text: FluTheme.dark ? control.lightText : control.darkText + radius: 0 + iconColor:control.textColor + onClicked:()=> darkClickListener(btn_dark) } FluIconButton{ id:btn_stay_top Layout.preferredWidth: 40 Layout.preferredHeight: 30 + padding: 0 + verticalPadding: 0 + horizontalPadding: 0 iconSource : FluentIcons.Pinned Layout.alignment: Qt.AlignVCenter - iconSize: 13 + iconSize: 14 visible: { if(!(d.win instanceof FluWindow)){ return false @@ -232,6 +242,9 @@ Rectangle{ id:btn_minimize Layout.preferredWidth: 40 Layout.preferredHeight: 30 + padding: 0 + verticalPadding: 0 + horizontalPadding: 0 iconSource : FluentIcons.ChromeMinimize Layout.alignment: Qt.AlignVCenter iconSize: 11 @@ -251,6 +264,9 @@ Rectangle{ id:btn_maximize Layout.preferredWidth: 40 Layout.preferredHeight: 30 + padding: 0 + verticalPadding: 0 + horizontalPadding: 0 iconSource : d.isRestore ? FluentIcons.ChromeRestore : FluentIcons.ChromeMaximize color: { if(down){ @@ -271,11 +287,14 @@ Rectangle{ } FluIconButton{ id:btn_close + Layout.preferredWidth: 40 + Layout.preferredHeight: 30 + padding: 0 + verticalPadding: 0 + horizontalPadding: 0 iconSource : FluentIcons.ChromeClose Layout.alignment: Qt.AlignVCenter text:closeText - Layout.preferredWidth: 40 - Layout.preferredHeight: 30 visible: !isMac && showClose radius: 0 iconSize: 10 diff --git a/src/Qt5/imports/FluentUI/Controls/FluWindow.qml b/src/Qt5/imports/FluentUI/Controls/FluWindow.qml index abf904af..45ace81d 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluWindow.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluWindow.qml @@ -237,7 +237,7 @@ Window { clip: true } FluLoader{ - property string loadingText: "加载中..." + property string loadingText property bool cancel: false id:loader_loading anchors.fill: parent @@ -290,8 +290,8 @@ Window { } function moveWindowToDesktopCenter(){ screen = Qt.application.screens[FluTools.cursorScreenIndex()] - var taskBarHeight = FluTools.getTaskBarHeight(window) - window.setGeometry((Screen.width-window.width)/2+Screen.virtualX,(Screen.height-window.height-taskBarHeight)/2+Screen.virtualY,window.width,window.height) + var availableGeometry = FluTools.desktopAvailableGeometry(window) + window.setGeometry((availableGeometry.width-window.width)/2+Screen.virtualX,(availableGeometry.height-window.height)/2+Screen.virtualY,window.width,window.height) } function fixWindowSize(){ if(fixSize){ diff --git a/src/Qt5/imports/FluentUI/plugins.qmltypes b/src/Qt5/imports/FluentUI/plugins.qmltypes index b3d96a22..ca5f7803 100644 --- a/src/Qt5/imports/FluentUI/plugins.qmltypes +++ b/src/Qt5/imports/FluentUI/plugins.qmltypes @@ -2322,6 +2322,7 @@ Module { defaultProperty: "data" Property { name: "title"; type: "string" } Property { name: "darkText"; type: "string" } + Property { name: "lightText"; type: "string" } Property { name: "minimizeText"; type: "string" } Property { name: "restoreText"; type: "string" } Property { name: "maximizeText"; type: "string" } @@ -2381,7 +2382,7 @@ Module { } Property { name: "buttonDark" - type: "FluToggleSwitch_QMLTYPE_22" + type: "FluIconButton_QMLTYPE_17" isReadonly: true isPointer: true } @@ -3052,15 +3053,15 @@ Module { defaultProperty: "data" Property { name: "logo"; type: "QUrl" } Property { name: "title"; type: "string" } - Property { name: "items"; type: "FluObject_QMLTYPE_157"; isPointer: true } - Property { name: "footerItems"; type: "FluObject_QMLTYPE_157"; isPointer: true } + Property { name: "items"; type: "FluObject_QMLTYPE_129"; isPointer: true } + Property { name: "footerItems"; type: "FluObject_QMLTYPE_129"; 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_47"; isPointer: true } - Property { name: "navItemExpanderRightMenu"; type: "FluMenu_QMLTYPE_47"; isPointer: true } + Property { name: "navItemRightMenu"; type: "FluMenu_QMLTYPE_31"; isPointer: true } + Property { name: "navItemExpanderRightMenu"; type: "FluMenu_QMLTYPE_31"; isPointer: true } Property { name: "navCompactWidth"; type: "int" } Property { name: "navTopMargin"; type: "int" } Property { name: "cellHeight"; type: "int" } diff --git a/src/Qt6/imports/FluentUI/Controls/FluAppBar.qml b/src/Qt6/imports/FluentUI/Controls/FluAppBar.qml index b4352ee4..818af87f 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluAppBar.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluAppBar.qml @@ -6,7 +6,8 @@ import FluentUI Rectangle{ property string title: "" - property string darkText : "夜间模式" + property string darkText : "深色" + property string lightText : "浅色" property string minimizeText : "最小化" property string restoreText : "向下还原" property string maximizeText : "最大化" @@ -199,24 +200,33 @@ Rectangle{ Component.onCompleted: { setHitTestVisible(layout_row) } - FluToggleSwitch{ + FluIconButton{ id:btn_dark + Layout.preferredWidth: 40 + Layout.preferredHeight: 30 + padding: 0 + verticalPadding: 0 + horizontalPadding: 0 + rightPadding: 2 + iconSource: FluTheme.dark ? FluentIcons.Brightness : FluentIcons.QuietHours Layout.alignment: Qt.AlignVCenter - Layout.rightMargin: 5 + iconSize: 15 visible: showDark - text:darkText - textColor:control.textColor - checked: FluTheme.dark - textRight: false - clickListener:()=> darkClickListener(btn_dark) + text: FluTheme.dark ? control.lightText : control.darkText + radius: 0 + iconColor:control.textColor + onClicked:()=> darkClickListener(btn_dark) } FluIconButton{ id:btn_stay_top Layout.preferredWidth: 40 Layout.preferredHeight: 30 + padding: 0 + verticalPadding: 0 + horizontalPadding: 0 iconSource : FluentIcons.Pinned Layout.alignment: Qt.AlignVCenter - iconSize: 13 + iconSize: 14 visible: { if(!(d.win instanceof FluWindow)){ return false @@ -232,6 +242,9 @@ Rectangle{ id:btn_minimize Layout.preferredWidth: 40 Layout.preferredHeight: 30 + padding: 0 + verticalPadding: 0 + horizontalPadding: 0 iconSource : FluentIcons.ChromeMinimize Layout.alignment: Qt.AlignVCenter iconSize: 11 @@ -251,6 +264,9 @@ Rectangle{ id:btn_maximize Layout.preferredWidth: 40 Layout.preferredHeight: 30 + padding: 0 + verticalPadding: 0 + horizontalPadding: 0 iconSource : d.isRestore ? FluentIcons.ChromeRestore : FluentIcons.ChromeMaximize color: { if(down){ @@ -271,11 +287,14 @@ Rectangle{ } FluIconButton{ id:btn_close + Layout.preferredWidth: 40 + Layout.preferredHeight: 30 + padding: 0 + verticalPadding: 0 + horizontalPadding: 0 iconSource : FluentIcons.ChromeClose Layout.alignment: Qt.AlignVCenter text:closeText - Layout.preferredWidth: 40 - Layout.preferredHeight: 30 visible: !isMac && showClose radius: 0 iconSize: 10 diff --git a/src/Qt6/imports/FluentUI/Controls/FluWindow.qml b/src/Qt6/imports/FluentUI/Controls/FluWindow.qml index 87e9ce8a..c18aea6b 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluWindow.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluWindow.qml @@ -236,7 +236,7 @@ Window { clip: true } FluLoader{ - property string loadingText: "加载中..." + property string loadingText property bool cancel: false id:loader_loading anchors.fill: parent @@ -289,8 +289,8 @@ Window { } function moveWindowToDesktopCenter(){ screen = Qt.application.screens[FluTools.cursorScreenIndex()] - var taskBarHeight = FluTools.getTaskBarHeight(window) - window.setGeometry((Screen.width-window.width)/2+Screen.virtualX,(Screen.height-window.height-taskBarHeight)/2+Screen.virtualY,window.width,window.height) + var availableGeometry = FluTools.desktopAvailableGeometry(window) + window.setGeometry((availableGeometry.width-window.width)/2+Screen.virtualX,(availableGeometry.height-window.height)/2+Screen.virtualY,window.width,window.height) } function fixWindowSize(){ if(fixSize){