mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-08-15 18:43:59 +00:00
NIconButton: added native tooltip handling
This commit is contained in:
@@ -11,6 +11,7 @@ Rectangle {
|
||||
property real sizeMultiplier: 0.8
|
||||
property real size: Style.baseWidgetSize * sizeMultiplier * scaling
|
||||
property string icon
|
||||
property string tooltipText
|
||||
property bool enabled: true
|
||||
property bool hovering: false
|
||||
property var onEntered: function () {}
|
||||
@@ -37,16 +38,29 @@ Rectangle {
|
||||
opacity: root.enabled ? Style.opacityFull : Style.opacityMedium
|
||||
}
|
||||
|
||||
NTooltip {
|
||||
id: tooltip
|
||||
target: root
|
||||
positionAbove: false
|
||||
text: root.tooltipText
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
hoverEnabled: true
|
||||
onEntered: {
|
||||
hovering = true
|
||||
if (tooltipText) {
|
||||
tooltip.show()
|
||||
}
|
||||
root.onEntered()
|
||||
}
|
||||
onExited: {
|
||||
hovering = false
|
||||
if (tooltipText) {
|
||||
tooltip.hide()
|
||||
}
|
||||
root.onExited()
|
||||
}
|
||||
onClicked: {
|
||||
|
||||
Reference in New Issue
Block a user