Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions qt6/src/qml/DialogTitleBar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,14 @@ Item {

property var __dwindow: Window.window.D.DWindow

MouseArea {
anchors.fill: parent
acceptedButtons: Qt.AllButtons
propagateComposedEvents: true
onPressed: function(mouse) {
if (mouse.button === Qt.RightButton) {
if (mouse.x < control.width - closeBtn.width) {
TapHandler {
acceptedButtons: Qt.RightButton
onTapped: function (eventPoint, button) {
if (button === Qt.RightButton) {
if (eventPoint.position.x < control.width - closeBtn.width) {
__dwindow.popupSystemWindowMenu()
mouse.accepted = true
return
}
}
mouse.accepted = false
}
}

Expand Down
50 changes: 22 additions & 28 deletions qt6/src/qml/TitleBar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ import QtQuick.Layouts
import org.deepin.dtk 1.0 as D
import org.deepin.dtk.style 1.0 as DS

Control {
Item {
id: control
z: D.DTK.TopOrder
width: Window.window.width
// it's binding `height` instead of `visible` property,
// because MouseArea should accept event keeping visible.
implicitHeight: (!__isFullScreen || __isVisible) ? DS.Style.titleBar.height : 0
hoverEnabled: __isFullScreen && autoHideOnFullscreen // TODO can't drag in qt6
implicitHeight: (!__isFullScreen || __isVisible) ? DS.Style.titleBar.height : 1

property string title: Window.window.title
property alias icon: iconLabel
Expand All @@ -40,41 +39,36 @@ Control {

property var __dwindow: Window.window.D.DWindow
property bool __isFullScreen: Window.window.visibility === Window.FullScreen
property bool __isVisible: mouseArea.containsMouse
property bool __isVisible: hoverHandler.hovered
readonly property int __includedAreaX: control.width - optionMenuBtn.width - windowButtonsLoader.width

property alias enableInWindowBlendBlur: background.active
// Control's property
property alias background: background.sourceComponent
property alias hovered: hoverHandler.hovered
property alias hoverEnabled: hoverHandler.enabled

property D.Palette textColor: DS.Style.button.text
palette.windowText: D.ColorSelector.textColor
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: __isFullScreen && autoHideOnFullscreen
acceptedButtons: Qt.AllButtons
propagateComposedEvents: true

onPressed: function(mouse) {
if (mouse.button === Qt.RightButton) {
if (mouse.x < __includedAreaX) {
__dwindow.popupSystemWindowMenu()
mouse.accepted = true
return
}
HoverHandler {
enabled: __isFullScreen && autoHideOnFullscreen
id: hoverHandler
}
TapHandler {
acceptedButtons: Qt.RightButton | Qt.LeftButton
onDoubleTapped: function (eventPoint, button) {
if (button === Qt.LeftButton) {
control.toggleWindowState()
}
mouse.accepted = false
}
onDoubleClicked: function(mouse) {
// Windowed or Maximized
if (mouse.button === Qt.LeftButton) {
control.toggleWindowState()
mouse.accepted = true
return
onTapped: function (eventPoint, button) {
if (button === Qt.RightButton) {
if (eventPoint.position.x < __includedAreaX) {
__dwindow.popupSystemWindowMenu()
}
}
mouse.accepted = false
}
onReleased: function(mouse) { mouse.accepted = false }
onClicked: function(mouse) { mouse.accepted = false }
}

Loader {
Expand All @@ -89,7 +83,7 @@ Control {
id: content
spacing: 0
anchors.fill: parent
visible: control.height > 0
visible: control.height > 1

Loader {
active: embedMode
Expand Down