Fix Long Topics in the RoomDrawer Overflowing
Use a scrollView for the topic so that a scrollBar is shown when it really long BUG: 467512
This commit is contained in:
@@ -157,24 +157,35 @@ Kirigami.OverlayDrawer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TextEdit {
|
QQC2.ScrollView {
|
||||||
Layout.leftMargin: Kirigami.Units.largeSpacing
|
Layout.leftMargin: Kirigami.Units.largeSpacing
|
||||||
Layout.rightMargin: Kirigami.Units.largeSpacing
|
Layout.rightMargin: Kirigami.Units.largeSpacing
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
text: room && room.topic ? room.topic.replace(replaceLinks, "<a href=\"$1\">$1</a>") : i18n("No Topic")
|
Layout.fillHeight: true
|
||||||
readonly property var replaceLinks: /(http[s]?:\/\/[^ \r\n]*)/g
|
Layout.minimumHeight: Math.min(topicText.contentHeight, Kirigami.Units.gridUnit * 15)
|
||||||
textFormat: TextEdit.MarkdownText
|
|
||||||
wrapMode: Text.WordWrap
|
// HACK: Hide unnecessary horizontal scrollbar (https://bugreports.qt.io/browse/QTBUG-83890)
|
||||||
selectByMouse: true
|
QQC2.ScrollBar.horizontal.policy: QQC2.ScrollBar.AlwaysOff
|
||||||
color: Kirigami.Theme.textColor
|
|
||||||
selectedTextColor: Kirigami.Theme.highlightedTextColor
|
QQC2.TextArea {
|
||||||
selectionColor: Kirigami.Theme.highlightColor
|
id: topicText
|
||||||
onLinkActivated: UrlHelper.openUrl(link)
|
padding: 0
|
||||||
readOnly: true
|
text: room && room.topic ? room.topic.replace(replaceLinks, "<a href=\"$1\">$1</a>") : i18n("No Topic")
|
||||||
MouseArea {
|
readonly property var replaceLinks: /(http[s]?:\/\/[^ \r\n]*)/g
|
||||||
anchors.fill: parent
|
textFormat: TextEdit.MarkdownText
|
||||||
acceptedButtons: Qt.NoButton
|
wrapMode: Text.WordWrap
|
||||||
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.IBeamCursor
|
selectByMouse: true
|
||||||
|
color: Kirigami.Theme.textColor
|
||||||
|
selectedTextColor: Kirigami.Theme.highlightedTextColor
|
||||||
|
selectionColor: Kirigami.Theme.highlightColor
|
||||||
|
onLinkActivated: UrlHelper.openUrl(link)
|
||||||
|
readOnly: true
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
acceptedButtons: Qt.NoButton
|
||||||
|
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.IBeamCursor
|
||||||
|
}
|
||||||
|
background: Item {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -270,6 +281,7 @@ Kirigami.OverlayDrawer {
|
|||||||
QQC2.ScrollView {
|
QQC2.ScrollView {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
Layout.minimumHeight: Math.min(topicText.contentHeight, Kirigami.Units.gridUnit * 15)
|
||||||
|
|
||||||
// HACK: Hide unnecessary horizontal scrollbar (https://bugreports.qt.io/browse/QTBUG-83890)
|
// HACK: Hide unnecessary horizontal scrollbar (https://bugreports.qt.io/browse/QTBUG-83890)
|
||||||
QQC2.ScrollBar.horizontal.policy: QQC2.ScrollBar.AlwaysOff
|
QQC2.ScrollBar.horizontal.policy: QQC2.ScrollBar.AlwaysOff
|
||||||
|
|||||||
Reference in New Issue
Block a user