Skip to content

Commit

Permalink
Align text boxes throughout the room header both in Qt 5 and 6
Browse files Browse the repository at this point in the history
Also, add a bit of padding to the topic box so that the frame that
Breeze theme adds doesn't stick to the text.
  • Loading branch information
KitsuneRal committed Oct 23, 2023
1 parent 2ee7b83 commit 60aa0fe
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions client/qml/Timeline.qml
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,15 @@ Page {

spacing: 2

readonly property int innerLeftPadding: 4

TextArea {
id: roomName
width: roomNameMetrics.advanceWidth + leftPadding
height: roomNameMetrics.height
clip: true
padding: 0
leftPadding: 2
leftPadding: headerText.innerLeftPadding

TextMetrics {
id: roomNameMetrics
Expand Down Expand Up @@ -106,6 +108,7 @@ Page {
id: versionNotice
visible: !!room && (room.isUnstable || room.successorId !== "")
width: parent.width
leftPadding: headerText.innerLeftPadding

text: !room ? "" :
room.successorId !== ""
Expand All @@ -129,9 +132,12 @@ Page {
width: parent.width
// Allow 6 lines of the topic but not more than 20% of the
// timeline vertical space; if there are more than 6 lines
// show half-line as a hint
height: Math.min(topicText.contentHeight, root.height / 5,
settings.lineSpacing * 6.5)
// reveal the top of the 7th line as a hint
height: Math.min(
topicText.contentHeight,
root.height / 5,
settings.lineSpacing * 6.6)
+ topicText.topPadding + topicText.bottomPadding
clip: true

ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
Expand All @@ -147,10 +153,10 @@ Page {
// (RichTextField?).
TextArea {
id: topicText
width: topicField.width
padding: 0
padding: 2
leftPadding: headerText.innerLeftPadding
rightPadding: topicField.ScrollBar.vertical.visible
? topicField.ScrollBar.vertical.width : 0
? topicField.ScrollBar.vertical.width : padding

text: room ? room.prettyPrint(room.topic) : ""
placeholderText: qsTr("(no topic)")
Expand Down

0 comments on commit 60aa0fe

Please sign in to comment.