Skip to content

Commit

Permalink
fix: application tray and collapse tray dose not have tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
mhduiy authored and deepin-bot[bot] committed Jul 31, 2024
1 parent 6fcc5d0 commit 1902367
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 4 deletions.
35 changes: 31 additions & 4 deletions panels/dock/tray/package/ActionShowStashDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ AppletItemButton {
return Qt.point(x + width / 2, y + height / 2)
}

HoverHandler {
id: hoverHandler
}

onItemGlobalPointChanged: {
stashedPopup.collapsedBtnCenterPoint = itemGlobalPoint
}
Expand Down Expand Up @@ -91,5 +87,36 @@ AppletItemButton {

onClicked: {
stashedPopup.open()
toolTip.close()
}

PanelToolTip {
id: toolTip
text: qsTr("Application tray")
toolTipX: DockPanelPositioner.x
toolTipY: DockPanelPositioner.y
}
Timer {
id: toolTipShowTimer
interval: 200
onTriggered: {
var point = root.mapToItem(null, root.width / 2, root.height / 2)
toolTip.DockPanelPositioner.bounding = Qt.rect(point.x, point.y, toolTip.width, toolTip.height)
toolTip.open()
}
}
HoverHandler {
id: hoverHandler
onHoveredChanged: {
if (hovered) {
toolTipShowTimer.start()
} else {
if (toolTipShowTimer.running) {
toolTipShowTimer.stop()
}

toolTip.close()
}
}
}
}
33 changes: 33 additions & 0 deletions panels/dock/tray/package/ActionToggleCollapseDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
import QtQuick
import QtQuick.Controls
import org.deepin.dtk 1.0 as D
import org.deepin.ds 1.0
import org.deepin.ds.dock.tray 1.0 as DDT
import org.deepin.ds.dock 1.0

AppletItemButton {
id: root
property bool isHorizontal: false
property bool collapsed: DDT.TraySortOrderModel.collapsed

Expand All @@ -20,5 +22,36 @@ AppletItemButton {

onClicked: {
DDT.TraySortOrderModel.collapsed = !DDT.TraySortOrderModel.collapsed
toolTip.close()
}

PanelToolTip {
id: toolTip
text: qsTr("Collapse tray")
toolTipX: DockPanelPositioner.x
toolTipY: DockPanelPositioner.y
}
Timer {
id: toolTipShowTimer
interval: 200
onTriggered: {
var point = root.mapToItem(null, root.width / 2, root.height / 2)
toolTip.DockPanelPositioner.bounding = Qt.rect(point.x, point.y, toolTip.width, toolTip.height)
toolTip.open()
}
}
HoverHandler {
id: hoverHandler
onHoveredChanged: {
if (hovered) {
toolTipShowTimer.start()
} else {
if (toolTipShowTimer.running) {
toolTipShowTimer.stop()
}

toolTip.close()
}
}
}
}

0 comments on commit 1902367

Please sign in to comment.