2019-12-19 22:46:16 +11:00
|
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
|
2019-07-13 08:02:14 +10:00
|
|
|
import QtQuick 2.12
|
2019-07-13 19:39:01 +10:00
|
|
|
import QtQuick.Controls 2.12
|
2019-09-12 06:47:13 +10:00
|
|
|
import QtQuick.Layouts 1.12
|
2019-07-10 12:51:52 +10:00
|
|
|
|
|
|
|
ToolTip {
|
2019-07-10 13:42:03 +10:00
|
|
|
id: toolTip
|
2019-08-22 23:27:26 +10:00
|
|
|
delay: theme.controls.toolTip.delay
|
|
|
|
padding: background.border.width
|
|
|
|
|
2019-09-08 04:14:04 +10:00
|
|
|
|
|
|
|
property alias label: label
|
2019-09-13 10:04:46 +10:00
|
|
|
property alias backgroundColor: background.color
|
2019-09-08 04:14:04 +10:00
|
|
|
|
2019-12-06 23:20:30 +11:00
|
|
|
readonly property bool hideNow: ! window.hovered
|
2019-12-06 22:07:40 +11:00
|
|
|
|
2019-12-06 23:20:30 +11:00
|
|
|
onHideNowChanged: if (visible && hideNow) toolTip.hide()
|
2019-12-06 22:07:40 +11:00
|
|
|
|
2019-09-08 04:14:04 +10:00
|
|
|
|
2019-08-28 12:46:31 +10:00
|
|
|
background: Rectangle {
|
2019-08-22 23:27:26 +10:00
|
|
|
id: background
|
|
|
|
color: theme.controls.toolTip.background
|
|
|
|
border.color: theme.controls.toolTip.border
|
|
|
|
border.width: theme.controls.toolTip.borderWidth
|
|
|
|
}
|
|
|
|
|
2019-09-12 06:47:13 +10:00
|
|
|
contentItem: HRowLayout {
|
|
|
|
HLabel {
|
|
|
|
id: label
|
|
|
|
color: theme.controls.toolTip.text
|
|
|
|
text: toolTip.text
|
|
|
|
wrapMode: Text.Wrap
|
|
|
|
|
|
|
|
leftPadding: theme.spacing / 1.5
|
|
|
|
rightPadding: leftPadding
|
|
|
|
topPadding: theme.spacing / 2
|
|
|
|
bottomPadding: topPadding
|
|
|
|
|
|
|
|
Layout.maximumWidth: Math.min(
|
2019-09-18 06:30:04 +10:00
|
|
|
window.width / 1.25, theme.fontSize.normal * 0.5 * 75,
|
2019-09-12 06:47:13 +10:00
|
|
|
)
|
|
|
|
}
|
2019-08-22 23:27:26 +10:00
|
|
|
}
|
2019-07-10 12:51:52 +10:00
|
|
|
|
|
|
|
enter: Transition {
|
|
|
|
HNumberAnimation { property: "opacity"; from: 0.0; to: 1.0 }
|
|
|
|
}
|
|
|
|
exit: Transition {
|
2019-09-18 06:30:04 +10:00
|
|
|
HNumberAnimation { property: "opacity"; to: 0.0 }
|
2019-07-10 12:51:52 +10:00
|
|
|
}
|
2019-07-10 13:49:59 +10:00
|
|
|
|
2019-07-13 08:02:14 +10:00
|
|
|
TapHandler {
|
2019-12-06 22:07:40 +11:00
|
|
|
onTapped: toolTip.hide()
|
2019-07-10 13:49:59 +10:00
|
|
|
}
|
2019-07-25 05:58:43 +10:00
|
|
|
|
|
|
|
HoverHandler {
|
2019-08-22 23:27:26 +10:00
|
|
|
onHoveredChanged: if (! hovered) toolTip.hide()
|
2019-07-25 05:58:43 +10:00
|
|
|
}
|
2019-07-10 12:51:52 +10:00
|
|
|
}
|