fix(tooltip): 替换Tooltip,修复反复触发tooltip问题
This commit is contained in:
parent
7a52fc5d45
commit
0d0916fc34
|
@ -18,6 +18,15 @@ MouseArea {
|
|||
border.width: 2
|
||||
}
|
||||
}
|
||||
|
||||
UkuiItems.Tooltip {
|
||||
anchors.fill: parent
|
||||
mainText: name
|
||||
posFollowCursor: true
|
||||
margin: 6
|
||||
visible: content.textTruncated
|
||||
}
|
||||
|
||||
UkuiItems.StyleBackground {
|
||||
id: controlBase
|
||||
anchors.fill: parent
|
||||
|
@ -25,9 +34,6 @@ MouseArea {
|
|||
useStyleTransparency: false
|
||||
paletteRole: Platform.Theme.Text
|
||||
alpha: isSelect ? 1.00 : control.containsPress ? 0.16 : control.containsMouse ? 0.08 : 0.00
|
||||
ToolTip.visible: content.textTruncated && control.containsMouse
|
||||
ToolTip.text: name
|
||||
ToolTip.delay: 500
|
||||
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
|
|
|
@ -12,15 +12,14 @@ MouseArea {
|
|||
property bool isSelect: false
|
||||
hoverEnabled: true
|
||||
|
||||
ToolTip {
|
||||
property bool isVisible: !editStatus && truncate && control.containsMouse
|
||||
id: tip
|
||||
x: mouseX + 15
|
||||
y: mouseY + 15
|
||||
text: name
|
||||
visible: !editStatus && truncate && control.containsMouse
|
||||
delay: 500
|
||||
UkuiItems.Tooltip {
|
||||
anchors.fill: parent
|
||||
mainText: name
|
||||
posFollowCursor: true
|
||||
margin: 6
|
||||
visible: !editStatus && truncate
|
||||
}
|
||||
|
||||
onPositionChanged: {
|
||||
if (tip.isVisible) {
|
||||
if (tip.visible) {
|
||||
|
|
|
@ -53,9 +53,13 @@ UkuiItems.StyleBackground {
|
|||
width: height
|
||||
height: parent.height
|
||||
|
||||
ToolTip.delay: 500
|
||||
ToolTip.text: modelData.toolTip
|
||||
ToolTip.visible: modelData.toolTip !== "" && containsMouse
|
||||
UkuiItems.Tooltip {
|
||||
anchors.fill: parent
|
||||
mainText: modelData.toolTip
|
||||
posFollowCursor: true
|
||||
margin: 6
|
||||
visible: modelData.toolTip !== ""
|
||||
}
|
||||
|
||||
background.radius: width / 2
|
||||
background.paletteRole: Platform.Theme.Highlight
|
||||
|
|
|
@ -42,18 +42,14 @@ Item {
|
|||
Layout.preferredHeight: 36
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
|
||||
UkuiItems.ToolTip.text: mainWindow.isFullScreen ? qsTr("Contract") : qsTr("Expand")
|
||||
|
||||
onEntered: {
|
||||
UkuiItems.ToolTip.show(fullScreenButton.mapToGlobal(0, fullScreenButton.height));
|
||||
}
|
||||
|
||||
onExited: {
|
||||
UkuiItems.ToolTip.hide();
|
||||
UkuiItems.Tooltip {
|
||||
anchors.fill: parent
|
||||
mainText: mainWindow.isFullScreen ? qsTr("Contract") : qsTr("Expand")
|
||||
posFollowCursor: true
|
||||
margin: 6
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
UkuiItems.ToolTip.hide();
|
||||
if (mainWindow.isFullScreen) {
|
||||
mainWindow.exitFullScreen();
|
||||
} else {
|
||||
|
@ -93,14 +89,11 @@ Item {
|
|||
icon.width: 24
|
||||
icon.height: 24
|
||||
|
||||
UkuiItems.ToolTip.text: totalUtils.realName
|
||||
|
||||
onEntered: {
|
||||
UkuiItems.ToolTip.show(userInfoButton.mapToGlobal(0, userInfoButton.height));
|
||||
}
|
||||
|
||||
onExited: {
|
||||
UkuiItems.ToolTip.hide();
|
||||
UkuiItems.Tooltip {
|
||||
anchors.fill: parent
|
||||
mainText: totalUtils.realName
|
||||
posFollowCursor: true
|
||||
margin: 6
|
||||
}
|
||||
|
||||
onClicked: totalUtils.openUserCenter()
|
||||
|
@ -122,14 +115,11 @@ Item {
|
|||
Layout.preferredHeight: 36
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
|
||||
UkuiItems.ToolTip.text: qsTr("Computer")
|
||||
|
||||
onEntered: {
|
||||
UkuiItems.ToolTip.show(computerButton.mapToGlobal(0, computerButton.height));
|
||||
}
|
||||
|
||||
onExited: {
|
||||
UkuiItems.ToolTip.hide();
|
||||
UkuiItems.Tooltip {
|
||||
anchors.fill: parent
|
||||
mainText: qsTr("Computer")
|
||||
posFollowCursor: true
|
||||
margin: 6
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
|
@ -153,14 +143,11 @@ Item {
|
|||
Layout.preferredHeight: 36
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
|
||||
UkuiItems.ToolTip.text: qsTr("Control center")
|
||||
|
||||
onEntered: {
|
||||
UkuiItems.ToolTip.show(setButton.mapToGlobal(0, setButton.height));
|
||||
}
|
||||
|
||||
onExited: {
|
||||
UkuiItems.ToolTip.hide();
|
||||
UkuiItems.Tooltip {
|
||||
anchors.fill: parent
|
||||
mainText: qsTr("Control center")
|
||||
posFollowCursor: true
|
||||
margin: 6
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
|
@ -184,7 +171,12 @@ Item {
|
|||
Layout.preferredHeight: 36
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
|
||||
UkuiItems.ToolTip.text: powerButtonBase.toolTip
|
||||
UkuiItems.Tooltip {
|
||||
anchors.fill: parent
|
||||
mainText: powerButtonBase.toolTip
|
||||
posFollowCursor: true
|
||||
margin: 6
|
||||
}
|
||||
|
||||
PowerButton {
|
||||
id: powerButtonBase
|
||||
|
@ -199,14 +191,6 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
onEntered: {
|
||||
UkuiItems.ToolTip.show(powerButton.mapToGlobal(0, powerButton.height));
|
||||
}
|
||||
|
||||
onExited: {
|
||||
UkuiItems.ToolTip.hide();
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
var buttonPosition = mapToGlobal(width, height);
|
||||
powerButtonBase.clicked(mouse.button === Qt.LeftButton, buttonPosition.x + spacingFromMenu, buttonPosition.y + spacingFromMenu, mainWindow.isFullScreen);
|
||||
|
|
Loading…
Reference in New Issue