mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-04-19 07:38:26 +00:00
52 lines
1.1 KiB
QML
52 lines
1.1 KiB
QML
import QtQuick 2.7
|
|
|
|
import Common 1.0
|
|
import Common.Styles 1.0
|
|
|
|
// =============================================================================
|
|
|
|
MouseArea {
|
|
id: tooltipArea
|
|
|
|
property alias text: tooltip.text
|
|
property int delay: TooltipStyle.delay
|
|
property bool force: false
|
|
property var tooltipParent: parent
|
|
|
|
property bool _visible: false
|
|
property int hoveringCursor : Qt.PointingHandCursor
|
|
|
|
anchors.fill:parent
|
|
|
|
hoverEnabled: true
|
|
scrollGestureEnabled: true
|
|
|
|
onContainsMouseChanged: _visible = containsMouse
|
|
cursorShape: containsMouse ? hoveringCursor : Qt.ArrowCursor
|
|
|
|
onPressed: mouse.accepted = false
|
|
onWheel: {
|
|
_visible = false
|
|
wheel.accepted = false
|
|
}
|
|
|
|
Tooltip {
|
|
id: tooltip
|
|
|
|
delay: tooltipArea.delay
|
|
parent: tooltipParent
|
|
visible: _visible || force
|
|
width: Math.min(tooltip.implicitWidth, Math.max(tooltipParent.width, TooltipStyle.minWidth))
|
|
|
|
//tooltipParent.width>TooltipStyle.minWidth?tooltipParent.width:TooltipStyle.minWidth
|
|
|
|
timeout: -1
|
|
|
|
// Workaround to always display tooltip.
|
|
onVisibleChanged: {
|
|
if (!visible && force) {
|
|
tooltip.visible = true
|
|
}
|
|
}
|
|
}
|
|
}
|