Remove HRichLabel component

Sparsly used and inflexible, just use HLabel
This commit is contained in:
miruka 2020-07-11 23:42:49 -04:00
parent 02982f9dc3
commit 229fbee298
5 changed files with 20 additions and 23 deletions

View File

@ -13,4 +13,6 @@ Label {
linkColor: theme.colors.link linkColor: theme.colors.link
maximumLineCount: elide === Label.ElideNone ? Number.MAX_VALUE : 1 maximumLineCount: elide === Label.ElideNone ? Number.MAX_VALUE : 1
onLinkActivated: Qt.openUrlExternally(link)
} }

View File

@ -1,16 +0,0 @@
// SPDX-License-Identifier: LGPL-3.0-or-later
import QtQuick 2.12
HLabel {
// https://blog.shantanu.io/2015/02/15/creating-working-hyperlinks-in-qtquick-text/
id: label
textFormat: Text.RichText
onLinkActivated: Qt.openUrlExternally(link)
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.NoButton
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor
}
}

View File

@ -16,7 +16,6 @@ TextEdit {
activeFocusOnPress: false activeFocusOnPress: false
focus: false focus: false
selectByMouse: true selectByMouse: true
onLinkActivated: if (enableLinkActivation) Qt.openUrlExternally(link) onLinkActivated: if (enableLinkActivation) Qt.openUrlExternally(link)

View File

@ -4,7 +4,9 @@ import QtQuick 2.12
import QtQuick.Layouts 1.12 import QtQuick.Layouts 1.12
import ".." import ".."
HRichLabel { HLabel {
property HTile tile
textFormat: Text.StyledText textFormat: Text.StyledText
font.pixelSize: theme.fontSize.small font.pixelSize: theme.fontSize.small
verticalAlignment: Qt.AlignVCenter verticalAlignment: Qt.AlignVCenter
@ -16,9 +18,12 @@ HRichLabel {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
property HTile tile
Behavior on Layout.maximumHeight { HNumberAnimation {} } Behavior on Layout.maximumHeight { HNumberAnimation {} }
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.NoButton
cursorShape:
parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor
}
} }

View File

@ -79,7 +79,7 @@ Rectangle {
HoverHandler { id: nameHover } HoverHandler { id: nameHover }
} }
HRichLabel { HLabel {
id: topicLabel id: topicLabel
text: chat.roomInfo.topic text: chat.roomInfo.topic
textFormat: Text.StyledText textFormat: Text.StyledText
@ -103,6 +103,13 @@ Rectangle {
Layout.fillHeight: true Layout.fillHeight: true
HoverHandler { id: topicHover } HoverHandler { id: topicHover }
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.NoButton
cursorShape:
parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor
}
} }
HToolTip { HToolTip {