2019-12-19 22:46:16 +11:00
|
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
|
2019-08-31 01:17:13 +10:00
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Controls 2.12
|
|
|
|
|
|
|
|
TextEdit {
|
|
|
|
id: label
|
|
|
|
font.family: theme.fontFamily.sans
|
|
|
|
font.pixelSize: theme.fontSize.normal
|
|
|
|
color: theme.colors.text
|
|
|
|
|
|
|
|
textFormat: Label.PlainText
|
|
|
|
tabStopDistance: 4 * 4 // 4 spaces
|
|
|
|
|
|
|
|
readOnly: true
|
2019-09-01 19:57:28 +10:00
|
|
|
activeFocusOnPress: false
|
|
|
|
focus: false
|
2020-05-30 07:42:24 +10:00
|
|
|
selectByMouse: true
|
2019-08-31 01:17:13 +10:00
|
|
|
|
2020-03-26 14:06:51 +11:00
|
|
|
onLinkActivated: if (enableLinkActivation) Qt.openUrlExternally(link)
|
|
|
|
|
|
|
|
|
|
|
|
property bool enableLinkActivation: true
|
2019-08-31 01:17:13 +10:00
|
|
|
|
|
|
|
|
|
|
|
function selectWordAt(position) {
|
|
|
|
label.cursorPosition = positionAt(position.x, position.y)
|
|
|
|
label.selectWord()
|
|
|
|
}
|
|
|
|
|
|
|
|
function selectAllText() {
|
|
|
|
label.selectAll()
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: label
|
|
|
|
acceptedButtons: Qt.NoButton
|
|
|
|
cursorShape: label.hoveredLink ? Qt.PointingHandCursor : Qt.IBeamCursor
|
|
|
|
}
|
|
|
|
}
|