From 542ea0a7b9da2b9b237bc25a57c04fc69d330103 Mon Sep 17 00:00:00 2001 From: zhuzichu Date: Tue, 21 Nov 2023 18:12:11 +0800 Subject: [PATCH] update --- example/qml-Qt6/window/MainWindow.qml | 1 - example/qml/window/MainWindow.qml | 1 - framelesshelper | 2 +- .../imports/FluentUI/Controls/FluAppBar.qml | 4 ++-- .../FluentUI/Controls/FluNavigationView.qml | 5 ----- .../imports/FluentUI/Controls/FluWindow.qml | 16 +++++--------- .../imports/FluentUI/Controls/FluAppBar.qml | 4 ++-- .../FluentUI/Controls/FluNavigationView.qml | 5 ----- .../imports/FluentUI/Controls/FluWindow.qml | 22 +++++-------------- 9 files changed, 15 insertions(+), 45 deletions(-) diff --git a/example/qml-Qt6/window/MainWindow.qml b/example/qml-Qt6/window/MainWindow.qml index 41c35548..84adb6d7 100644 --- a/example/qml-Qt6/window/MainWindow.qml +++ b/example/qml-Qt6/window/MainWindow.qml @@ -45,7 +45,6 @@ FluWindow { tour.open() checkUpdate(true) FluEventBus.registerEvent(event_checkupdate) - setHitTestVisible(layout_back_buttons) } Component.onDestruction: { diff --git a/example/qml/window/MainWindow.qml b/example/qml/window/MainWindow.qml index 29bca9a1..d844c7cb 100644 --- a/example/qml/window/MainWindow.qml +++ b/example/qml/window/MainWindow.qml @@ -48,7 +48,6 @@ FluWindow { tour.open() checkUpdate(true) FluEventBus.registerEvent(event_checkupdate) - setHitTestVisible(layout_back_buttons) } Component.onDestruction: { diff --git a/framelesshelper b/framelesshelper index 2613dd72..694967e9 160000 --- a/framelesshelper +++ b/framelesshelper @@ -1 +1 @@ -Subproject commit 2613dd72fd9bf37758caaafb43531e858a337639 +Subproject commit 694967e930d2dd9f15c5429674005cc0a4217060 diff --git a/src/Qt5/imports/FluentUI/Controls/FluAppBar.qml b/src/Qt5/imports/FluentUI/Controls/FluAppBar.qml index a680b844..4909b86f 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluAppBar.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluAppBar.qml @@ -72,10 +72,10 @@ Rectangle{ return false } property bool isRestore: win && Window.Maximized === win.visibility - property bool resizable: win && !(win.minimumHeight === win.maximumHeight && win.maximumWidth === win.minimumWidth) + property bool resizable: win && !(win.height === win.maximumHeight && win.height === win.minimumHeight && win.width === win.maximumWidth && win.width === win.minimumWidth) } TapHandler { - onTapped: if (tapCount === 2) btn_maximize.clicked() + onTapped: if (tapCount === 2 && d.resizable) btn_maximize.clicked() gesturePolicy: TapHandler.DragThreshold } DragHandler { diff --git a/src/Qt5/imports/FluentUI/Controls/FluNavigationView.qml b/src/Qt5/imports/FluentUI/Controls/FluNavigationView.qml index 5c1e2145..a532fd5f 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluNavigationView.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluNavigationView.qml @@ -86,11 +86,6 @@ Item { return FluNavigationViewType.Open } }) - if(Window.window instanceof FluWindow){ - Window.window.setHitTestVisible(backButton()) - Window.window.setHitTestVisible(navButton()) - Window.window.setHitTestVisible(logoButton()) - } timer_anim_delay.restart() } Timer{ diff --git a/src/Qt5/imports/FluentUI/Controls/FluWindow.qml b/src/Qt5/imports/FluentUI/Controls/FluWindow.qml index 442a1540..6d5aed31 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluWindow.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluWindow.qml @@ -38,7 +38,7 @@ Window { property bool showMinimize: true property bool showMaximize: true property bool showStayTop: true - readonly property bool useSystemAppBar: false + property bool useSystemAppBar: false property var closeListener: function(event){ if(closeDestory){ destoryOnClose() @@ -49,6 +49,10 @@ Window { } signal initArgument(var argument) id:window + maximumWidth: useSystemAppBar&&fixSize ? width : 16777215 + maximumHeight: useSystemAppBar&&fixSize ? height : 16777215 + minimumWidth: useSystemAppBar&&fixSize ? width : 0 + minimumHeight: useSystemAppBar&&fixSize ? height : 0 color:"transparent" onStayTopChanged: { d.changedStayTop() @@ -214,15 +218,8 @@ Window { flags = flags | Qt.Window | Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowSystemMenuHint | Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint if(appBar){ var appbar = window.appBar - setTitleBarItem(appbar) window.moveWindowToDesktopCenter() - setHitTestVisible(appbar.minimizeButton()) - setHitTestVisible(appbar.maximizeButton()) - setHitTestVisible(appbar.closeButton()) - setHitTestVisible(appbar.stayTopButton()) - setHitTestVisible(appbar.darkButton()) setWindowFixedSize(fixSize) - appbar.maximizeButton.visible = !fixSize if (blurBehindWindowEnabled) window.background = undefined } @@ -259,9 +256,6 @@ Window { } } } - function setHitTestVisible(item){ - framless_helper.setHitTestVisible(item) - } function destoryOnClose(){ lifecycle.onDestoryOnClose() } diff --git a/src/Qt6/imports/FluentUI/Controls/FluAppBar.qml b/src/Qt6/imports/FluentUI/Controls/FluAppBar.qml index 93f42672..cf9be1b0 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluAppBar.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluAppBar.qml @@ -72,10 +72,10 @@ Rectangle{ return false } property bool isRestore: win && Window.Maximized === win.visibility - property bool resizable: win && !(win.minimumHeight === win.maximumHeight && win.maximumWidth === win.minimumWidth) + property bool resizable: win && !(win.height === win.maximumHeight && win.height === win.minimumHeight && win.width === win.maximumWidth && win.width === win.minimumWidth) } TapHandler { - onTapped: if (tapCount === 2) btn_maximize.clicked() + onTapped: if (tapCount === 2 && d.resizable) btn_maximize.clicked() gesturePolicy: TapHandler.DragThreshold } DragHandler { diff --git a/src/Qt6/imports/FluentUI/Controls/FluNavigationView.qml b/src/Qt6/imports/FluentUI/Controls/FluNavigationView.qml index b3f7f7fc..7c284e08 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluNavigationView.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluNavigationView.qml @@ -87,11 +87,6 @@ Item { return FluNavigationViewType.Open } }) - if(Window.window instanceof FluWindow){ - Window.window.setHitTestVisible(backButton()) - Window.window.setHitTestVisible(navButton()) - Window.window.setHitTestVisible(logoButton()) - } timer_anim_delay.restart() } Timer{ diff --git a/src/Qt6/imports/FluentUI/Controls/FluWindow.qml b/src/Qt6/imports/FluentUI/Controls/FluWindow.qml index 0cc70c59..6637c8ce 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluWindow.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluWindow.qml @@ -37,7 +37,7 @@ Window { property bool showMinimize: true property bool showMaximize: true property bool showStayTop: true - readonly property bool useSystemAppBar: false + property bool useSystemAppBar: false property var closeListener: function(event){ if(closeDestory){ destoryOnClose() @@ -48,6 +48,10 @@ Window { } signal initArgument(var argument) id:window + maximumWidth: useSystemAppBar&&fixSize ? width : 16777215 + maximumHeight: useSystemAppBar&&fixSize ? height : 16777215 + minimumWidth: useSystemAppBar&&fixSize ? width : 0 + minimumHeight: useSystemAppBar&&fixSize ? height : 0 color:"transparent" onStayTopChanged: { d.changedStayTop() @@ -57,12 +61,6 @@ Window { initArgument(argument) d.changedStayTop() if(useSystemAppBar){ - if(fixSize){ - maximumHeight = height - minimumHeight = height - maximumWidth = width - minimumWidth = width - } window.moveWindowToDesktopCenter() window.visible = true } @@ -219,15 +217,8 @@ Window { flags = flags | Qt.Window | Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowSystemMenuHint | Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint if(appBar){ var appbar = window.appBar - setTitleBarItem(appbar) window.moveWindowToDesktopCenter() - setHitTestVisible(appbar.minimizeButton()) - setHitTestVisible(appbar.maximizeButton()) - setHitTestVisible(appbar.closeButton()) - setHitTestVisible(appbar.stayTopButton()) - setHitTestVisible(appbar.darkButton()) setWindowFixedSize(fixSize) - appbar.maximizeButton.visible = !fixSize if (blurBehindWindowEnabled) window.background = undefined } @@ -264,9 +255,6 @@ Window { } } } - function setHitTestVisible(item){ - framless_helper.setHitTestVisible(item) - } function destoryOnClose(){ lifecycle.onDestoryOnClose() }