linphone-desktop/linphone-app/ui/modules/Common/Tooltip/TooltipArea.qml
Julien Wadel 73733c17a0 * UTF8 fixes and display names behavior:
- Avoid to replace display if empty on address books search
- Propagate change when display name is set in callModel
- Add a way to update addresses when data model change outside of ChatRoomModel
- While calling and one participant, get display name from call remote address
- Update display names after adding a call log
- Fix UTF8 when compute display name
- Replace JS display name functions by CPP

* Fix tooltips width and timeline unexistant object
* MSYS2 bzip2 may block the process execution when no arguments. Add help args and remove outputs from streams.
2021-10-20 17:12:12 +02:00

82 lines
1.6 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 int maxWidth : window? window.width : tooltipParent.width
property bool _visible: false
property int hoveringCursor : Qt.PointingHandCursor
property bool isClickable : false
function show(){
if(isClickable){
if(tooltip.delay>0) {
tooltip.oldDelay = tooltip.delay
tooltip.delay = 0
}
tooltip.show(text, -1);
}
}
anchors.fill:parent
hoverEnabled: true
scrollGestureEnabled: true
onContainsMouseChanged: _visible = containsMouse
cursorShape: containsMouse ? hoveringCursor : Qt.ArrowCursor
onPressed: {
mouse.accepted = isClickable
}
onWheel: {
_visible = false
wheel.accepted = false
}
onClicked:{
show()
mouse.accepted = false
}
Tooltip {
id: tooltip
property int oldDelay : 0
delay: tooltipArea.delay
parent: tooltipParent
visible: _visible || force
width: Math.min(tooltip.implicitWidth, Math.max(tooltipArea.maxWidth, TooltipStyle.minWidth))
//tooltipParent.width>TooltipStyle.minWidth?tooltipParent.width:TooltipStyle.minWidth
timeout: -1
// Workaround to always display tooltip.
onVisibleChanged: {
if (!visible && force) {
tooltip.visible = true
}
}
MouseArea{
anchors.fill:parent
visible: tooltipArea.isClickable
onClicked : {
tooltip.hide()
tooltip.delay = tooltip.oldDelay
mouse.accepted = false
}
}
}
}