Debian Codegraph @

src/qml/Haruna/Components/LabelWithTooltip.qml

raw
1 /*
2 * SPDX-FileCopyrightText: 2021 George Florea Bănuș <[email protected]>
3 *
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 */
6
7 import QtQuick
8 import QtQuick.Controls as QQC2
9
10 QQC2.Label {
11 id: root
12
13 property string toolTipText
14 property int toolTipFontSize
15 property bool alwaysShowToolTip
16
17 QQC2.ToolTip {
18 id: toolTip
19
20 visible: (root.alwaysShowToolTip && mouseArea.containsMouse) || (mouseArea.containsMouse && root.truncated)
21 text: root.toolTipText ? root.toolTipText : root.text
22 font.pointSize: root.toolTipFontSize ? root.toolTipFontSize : root.font.pointSize
23 }
24
25 MouseArea {
26 id: mouseArea
27
28 anchors.fill: parent
29 acceptedButtons: Qt.NoButton
30 hoverEnabled: true
31 }
32 }