Skip to content

Commit

Permalink
sync: from linuxdeepin/dtkdeclarative
Browse files Browse the repository at this point in the history
Synchronize source files from linuxdeepin/dtkdeclarative.

Source-pull-request: linuxdeepin/dtkdeclarative#275
  • Loading branch information
deepin-ci-robot authored and 18202781743 committed Jan 10, 2024
1 parent d1df08e commit 8d9cc6f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 7 additions & 2 deletions qt6/src/qml/TitleBar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,12 @@ Control {
enabled: !menuDisabled
Layout.alignment: Qt.AlignRight
onClicked: {
var pos = Qt.point(optionMenuLoader.x, control.height)
optionMenuLoader.item.popup(optionMenuBtn, pos)
if (optionMenuLoader.item && optionMenuLoader.item.visible) {
optionMenuLoader.item.close()
} else {
var pos = Qt.point(optionMenuLoader.x, control.height)
optionMenuLoader.item.popup(optionMenuBtn, pos)
}
}

Loader {
Expand All @@ -158,6 +162,7 @@ Control {
AboutAction { aboutDialog: control.aboutDialog }
QuitAction { }
}
onLoaded: item.closePolicy = item.closePolicy | Popup.CloseOnPressOutsideParent
}
}

Expand Down
9 changes: 7 additions & 2 deletions src/qml/TitleBar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,12 @@ Control {
enabled: !menuDisabled
Layout.alignment: Qt.AlignRight
onClicked: {
var pos = Qt.point(optionMenuLoader.x, control.height)
optionMenuLoader.item.popup(optionMenuBtn, pos)
if (optionMenuLoader.item && optionMenuLoader.item.visible) {
optionMenuLoader.item.close()
} else {
var pos = Qt.point(optionMenuLoader.x, control.height)
optionMenuLoader.item.popup(optionMenuBtn, pos)
}
}

Loader {
Expand All @@ -157,6 +161,7 @@ Control {
AboutAction { aboutDialog: control.aboutDialog }
QuitAction { }
}
onLoaded: item.closePolicy = item.closePolicy | Popup.CloseOnPressOutsideParent
}
}

Expand Down

0 comments on commit 8d9cc6f

Please sign in to comment.