RibbonTitleBar,RibbonWindow: Add window active animation for window's btns in macOS.

This commit is contained in:
Mentalflow 2024-06-30 22:05:22 +08:00
parent 1cd113316c
commit e43b1eaf04
Signed by: Mentalflow
GPG Key ID: 5AE68D4401A2EE71
4 changed files with 16 additions and 4 deletions

View File

@ -112,11 +112,11 @@ Item {
top: parent.top top: parent.top
left: parent.left left: parent.left
bottom: parent.bottom bottom: parent.bottom
leftMargin: Qt.platform.os === "osx" && Window.window.visibility === Window.Windowed ? 65 : 10 leftMargin: Qt.platform.os === "osx" && Window.window.visibility === Window.Windowed && Window.active ? 65 : 10
} }
Behavior on anchors.leftMargin { Behavior on anchors.leftMargin {
NumberAnimation{ NumberAnimation{
duration: 100 duration: 50
easing.type: Easing.OutSine easing.type: Easing.OutSine
} }
} }

View File

@ -34,6 +34,12 @@ Window {
} }
return '#FFFFFF' return '#FFFFFF'
} }
onActiveChanged: {
if(Qt.platform.os === "osx")
PlatformSupport.showSystemTitleBtns(window,active)
}
onBlurBehindWindowChanged: { onBlurBehindWindowChanged: {
if (Qt.platform.os === 'windows') if (Qt.platform.os === 'windows')
windowAgent.setWindowAttribute("dwm-blur", blurBehindWindow) windowAgent.setWindowAttribute("dwm-blur", blurBehindWindow)

View File

@ -112,11 +112,11 @@ Item {
top: parent.top top: parent.top
left: parent.left left: parent.left
bottom: parent.bottom bottom: parent.bottom
leftMargin: Qt.platform.os === "osx" && Window.window.visibility === Window.Windowed ? 65 : 10 leftMargin: Qt.platform.os === "osx" && Window.window.visibility === Window.Windowed && Window.active ? 65 : 10
} }
Behavior on anchors.leftMargin { Behavior on anchors.leftMargin {
NumberAnimation{ NumberAnimation{
duration: 100 duration: 50
easing.type: Easing.OutSine easing.type: Easing.OutSine
} }
} }

View File

@ -34,6 +34,12 @@ Window {
} }
return '#FFFFFF' return '#FFFFFF'
} }
onActiveChanged: {
if(Qt.platform.os === "osx")
PlatformSupport.showSystemTitleBtns(window,active)
}
onBlurBehindWindowChanged: { onBlurBehindWindowChanged: {
if (Qt.platform.os === 'windows') if (Qt.platform.os === 'windows')
windowAgent.setWindowAttribute("dwm-blur", blurBehindWindow) windowAgent.setWindowAttribute("dwm-blur", blurBehindWindow)