| 1 |
/* |
| 2 |
* SPDX-FileCopyrightText: 2024 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 |
| 9 |
|
| 10 |
ToolButton { |
| 11 |
id: root |
| 12 |
|
| 13 |
required property string toolTipText |
| 14 |
property alias toolTipWidth: toolTip.width |
| 15 |
property alias toolTipHeight: toolTip.height |
| 16 |
readonly property int maxWidth: 300 |
| 17 |
|
| 18 |
icon.name: "documentinfo" |
| 19 |
checkable: true |
| 20 |
checked: false |
| 21 |
|
| 22 |
ToolTip { |
| 23 |
id: toolTip |
| 24 |
|
| 25 |
y: root.height |
| 26 |
visible: root.checked |
| 27 |
padding: 0 |
| 28 |
implicitWidth: Math.min(root.maxWidth, textArea.contentWidth) |
| 29 |
implicitHeight: textArea.implicitHeight |
| 30 |
|
| 31 |
delay: 0 |
| 32 |
timeout: -1 |
| 33 |
closePolicy: Popup.NoAutoClose |
| 34 |
|
| 35 |
contentItem: ScrollView { |
| 36 |
TextArea { |
| 37 |
id: textArea |
| 38 |
|
| 39 |
text: root.toolTipText |
| 40 |
readOnly: true |
| 41 |
textFormat: Text.RichText |
| 42 |
wrapMode: Text.WordWrap |
| 43 |
selectByMouse: true |
| 44 |
padding: 15 |
| 45 |
onLinkActivated: function(link) { |
| 46 |
Qt.openUrlExternally(link) |
| 47 |
} |
| 48 |
onHoveredLinkChanged: hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor |
| 49 |
} |
| 50 |
} |
| 51 |
} |
| 52 |
} |