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:
James Graham
2023-04-01 10:24:26 +00:00
parent 1438aea965
commit cefe5acdaa

View File

@@ -157,10 +157,19 @@ 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
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)
QQC2.ScrollBar.horizontal.policy: QQC2.ScrollBar.AlwaysOff
QQC2.TextArea {
id: topicText
padding: 0
text: room && room.topic ? room.topic.replace(replaceLinks, "<a href=\"$1\">$1</a>") : i18n("No Topic") text: room && room.topic ? room.topic.replace(replaceLinks, "<a href=\"$1\">$1</a>") : i18n("No Topic")
readonly property var replaceLinks: /(http[s]?:\/\/[^ \r\n]*)/g readonly property var replaceLinks: /(http[s]?:\/\/[^ \r\n]*)/g
textFormat: TextEdit.MarkdownText textFormat: TextEdit.MarkdownText
@@ -176,6 +185,8 @@ Kirigami.OverlayDrawer {
acceptedButtons: Qt.NoButton acceptedButtons: Qt.NoButton
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.IBeamCursor cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.IBeamCursor
} }
background: Item {}
}
} }
Kirigami.ListSectionHeader { Kirigami.ListSectionHeader {
@@ -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