fix(qml):【设计走查】功能排序工具提示显示位置不准确

This commit is contained in:
youdiansaodongxi 2023-12-05 09:22:08 +08:00
parent b6831d097d
commit 1170567ac1
3 changed files with 57 additions and 9 deletions

View File

@ -15,16 +15,32 @@ MouseArea {
border.width: 2 border.width: 2
} }
} }
ToolTip {
property bool isVisible: controlBase.isTextTruncated && control.containsMouse
id: tip
x: mouseX + 15
y: mouseY + 15
text: name
visible: controlBase.isTextTruncated && control.containsMouse
delay: 500
}
onPositionChanged: {
if (tip.isVisible) {
if (tip.visible) {
tip.hide();
} else {
tip.show(name);
}
}
}
StyleBackground { StyleBackground {
property bool isTextTruncated: content.textTruncated
id: controlBase id: controlBase
anchors.fill: parent anchors.fill: parent
radius: 4 radius: 4
useStyleTransparent: false useStyleTransparent: false
paletteRole: Palette.Light paletteRole: Palette.Light
alpha: isSelect ? 1.00 : control.containsPress ? 0.82 : control.containsMouse ? 0.55 : 0.00 alpha: isSelect ? 1.00 : control.containsPress ? 0.82 : control.containsMouse ? 0.55 : 0.00
ToolTip.visible: content.textTruncated && control.containsMouse
ToolTip.text: name
ToolTip.delay: 500
RowLayout { RowLayout {
anchors.fill: parent anchors.fill: parent

View File

@ -10,9 +10,26 @@ MouseArea {
property bool truncate: false property bool truncate: false
property bool isSelect: false property bool isSelect: false
hoverEnabled: true hoverEnabled: true
ToolTip.visible: !editStatus && truncate && control.containsMouse
ToolTip.text: name ToolTip {
ToolTip.delay: 500 property bool isVisible: !editStatus && truncate && control.containsMouse
id: tip
x: mouseX + 15
y: mouseY + 15
text: name
visible: !editStatus && truncate && control.containsMouse
delay: 500
}
onPositionChanged: {
if (tip.isVisible) {
if (tip.visible) {
tip.hide();
} else {
tip.show(name);
}
}
}
states: State { states: State {
when: control.activeFocus when: control.activeFocus
PropertyChanges { PropertyChanges {

View File

@ -6,9 +6,24 @@ import org.ukui.menu.core 1.0
MouseArea { MouseArea {
id: control id: control
hoverEnabled: true hoverEnabled: true
ToolTip.text: comment ToolTip {
ToolTip.visible: control.containsMouse property bool isVisible: control.containsMouse
ToolTip.delay: 500 id: tip
x: mouseX + 15
y: mouseY + 15
text: comment
visible: control.containsMouse
delay: 500
}
onPositionChanged: {
if (tip.isVisible) {
if (tip.visible) {
tip.hide();
} else {
tip.show(comment);
}
}
}
states: State { states: State {
when: control.activeFocus when: control.activeFocus
PropertyChanges { PropertyChanges {