moment/src/qml/Base/HToolTip.qml

53 lines
1.2 KiB
QML
Raw Normal View History

2019-07-13 08:02:14 +10:00
import QtQuick 2.12
import QtQuick.Controls 2.12
ToolTip {
id: toolTip
delay: theme.controls.toolTip.delay
padding: background.border.width
2019-09-08 04:00:01 +10:00
contentWidth: Math.min(
mainUI.width / 1.25,
contentItem.implicitWidth,
theme.fontSize.normal * 0.5 * 75,
)
property alias label: label
2019-08-28 12:46:31 +10:00
background: Rectangle {
id: background
color: theme.controls.toolTip.background
border.color: theme.controls.toolTip.border
border.width: theme.controls.toolTip.borderWidth
}
contentItem: HLabel {
id: label
color: theme.controls.toolTip.text
text: toolTip.text
2019-09-08 04:00:01 +10:00
wrapMode: Text.Wrap
property var pr: width
leftPadding: theme.spacing / 1.5
rightPadding: leftPadding
topPadding: theme.spacing / 2
bottomPadding: topPadding
}
enter: Transition {
HNumberAnimation { property: "opacity"; from: 0.0; to: 1.0 }
}
exit: Transition {
HNumberAnimation { property: "opacity"; from: 1.0; to: 0.0 }
}
2019-07-13 08:02:14 +10:00
TapHandler {
onTapped: { toolTip.hide() }
}
HoverHandler {
onHoveredChanged: if (! hovered) toolTip.hide()
}
}