From d5dd1292ffaab92df73bb88369b766a070971a16 Mon Sep 17 00:00:00 2001 From: miruka Date: Tue, 16 Jul 2019 05:08:27 -0400 Subject: [PATCH] wrap/elide: use Layout.fillWidth when possible --- TODO.md | 1 - src/qml/Chat/Banners/Banner.qml | 6 +----- src/qml/Chat/RoomSidePane/MemberDelegate.qml | 2 +- src/qml/Pages/EditAccount/Profile.qml | 1 + src/qml/Pages/RememberAccount.qml | 2 +- src/qml/SidePane/AccountDelegate.qml | 5 +++-- src/qml/SidePane/RoomDelegate.qml | 4 ++-- src/qml/UI.qml | 18 +++++++++--------- 8 files changed, 18 insertions(+), 21 deletions(-) diff --git a/TODO.md b/TODO.md index 0745a133..c1a82568 100644 --- a/TODO.md +++ b/TODO.md @@ -1,4 +1,3 @@ -- Can set `Layout.fillWidth: true` to elide/wrap - Use childrenRect stuff - Rename theme.bottomElementsHeight - Account delegate name color diff --git a/src/qml/Chat/Banners/Banner.qml b/src/qml/Chat/Banners/Banner.qml index 77c66beb..c7749cab 100644 --- a/src/qml/Chat/Banners/Banner.qml +++ b/src/qml/Chat/Banners/Banner.qml @@ -40,11 +40,7 @@ HRectangle { visible: bannerRow.width - bannerAvatar.width - bannerButtons.width > 30 - Layout.maximumWidth: - bannerRow.width - - bannerAvatar.width - bannerButtons.width - - Layout.leftMargin - Layout.rightMargin - + Layout.fillWidth: true Layout.leftMargin: 5 Layout.rightMargin: Layout.leftMargin } diff --git a/src/qml/Chat/RoomSidePane/MemberDelegate.qml b/src/qml/Chat/RoomSidePane/MemberDelegate.qml index 9267866c..37488839 100644 --- a/src/qml/Chat/RoomSidePane/MemberDelegate.qml +++ b/src/qml/Chat/RoomSidePane/MemberDelegate.qml @@ -38,7 +38,7 @@ HHighlightRectangle { elide: Text.ElideRight verticalAlignment: Qt.AlignVCenter - Layout.maximumWidth: parent.width + Layout.fillWidth: true } } } diff --git a/src/qml/Pages/EditAccount/Profile.qml b/src/qml/Pages/EditAccount/Profile.qml index 7ea0f28c..d13c0166 100644 --- a/src/qml/Pages/EditAccount/Profile.qml +++ b/src/qml/Pages/EditAccount/Profile.qml @@ -78,6 +78,7 @@ HGridLayout { color: Qt.hsla(0, 0, 0.9, 1) font.pixelSize: theme.fontSize.big wrapMode: Text.WordWrap + Layout.fillWidth: true Layout.alignment: Qt.AlignCenter } diff --git a/src/qml/Pages/RememberAccount.qml b/src/qml/Pages/RememberAccount.qml index 81b3f55c..e5ed148b 100644 --- a/src/qml/Pages/RememberAccount.qml +++ b/src/qml/Pages/RememberAccount.qml @@ -41,7 +41,7 @@ Item { wrapMode: Text.Wrap Layout.margins: rememberBox.margins - Layout.maximumWidth: rememberBox.width - Layout.margins * 2 + Layout.fillWidth: true } HSpacer {} diff --git a/src/qml/SidePane/AccountDelegate.qml b/src/qml/SidePane/AccountDelegate.qml index ead57585..a648cd6c 100644 --- a/src/qml/SidePane/AccountDelegate.qml +++ b/src/qml/SidePane/AccountDelegate.qml @@ -41,10 +41,11 @@ Column { HLabel { id: accountLabel text: userInfo.displayName || model.userId - elide: HLabel.ElideRight - Layout.fillWidth: true leftPadding: sidePane.currentSpacing rightPadding: leftPadding + + elide: HLabel.ElideRight + Layout.fillWidth: true } HTextField { diff --git a/src/qml/SidePane/RoomDelegate.qml b/src/qml/SidePane/RoomDelegate.qml index 92872340..3fa7214c 100644 --- a/src/qml/SidePane/RoomDelegate.qml +++ b/src/qml/SidePane/RoomDelegate.qml @@ -45,7 +45,7 @@ HHighlightRectangle { elide: Text.ElideRight verticalAlignment: Qt.AlignVCenter - Layout.maximumWidth: parent.width + Layout.fillWidth: true } HRichLabel { @@ -73,7 +73,7 @@ HHighlightRectangle { font.pixelSize: theme.fontSize.small elide: Text.ElideRight - Layout.maximumWidth: parent.width + Layout.fillWidth: true } } } diff --git a/src/qml/UI.qml b/src/qml/UI.qml index d513e2cf..f61bc3f3 100644 --- a/src/qml/UI.qml +++ b/src/qml/UI.qml @@ -86,17 +86,17 @@ Item { Timer { // TODO: remove this, debug id: initialRoomTimer - interval: 2000 + interval: 5000 repeat: false - // onTriggered: pageStack.showRoom( - // "@test_mary:matrix.org", - // "Rooms", - // "!TSXGsbBbdwsdylIOJZ:matrix.org" - // ) - onTriggered: pageStack.showPage( - "EditAccount/EditAccount", - {"userId": "@test_mary:matrix.org"} + onTriggered: pageStack.showRoom( + "@test_mary:matrix.org", + "Rooms", + "!TSXGsbBbdwsdylIOJZ:matrix.org" ) + // onTriggered: pageStack.showPage( + // "EditAccount/EditAccount", + // {"userId": "@test_mary:matrix.org"} + // ) } onCurrentItemChanged: if (currentItem) {