summary refs log tree commit diff
path: root/resources/qml/delegates
diff options
context:
space:
mode:
authorMalte E <malte.e@mailbox.org>2022-02-11 22:02:30 +0100
committerMalte E <malte.e@mailbox.org>2022-02-11 22:02:30 +0100
commitd0ac110cb7013124c511bbe3ea2dc05db9e695b2 (patch)
tree81d12ddf7159dac63d731153e1ce999301d98b28 /resources/qml/delegates
parentfixed most of the binding loops (diff)
downloadnheko-d0ac110cb7013124c511bbe3ea2dc05db9e695b2.tar.xz
Fix layout - no more binding loops (hopefully)
Diffstat (limited to 'resources/qml/delegates')
-rw-r--r--resources/qml/delegates/FileMessage.qml5
-rw-r--r--resources/qml/delegates/ImageMessage.qml11
-rw-r--r--resources/qml/delegates/MessageDelegate.qml13
-rw-r--r--resources/qml/delegates/Pill.qml4
-rw-r--r--resources/qml/delegates/PlayableMediaMessage.qml11
-rw-r--r--resources/qml/delegates/Redacted.qml11
-rw-r--r--resources/qml/delegates/Reply.qml4
7 files changed, 21 insertions, 38 deletions
diff --git a/resources/qml/delegates/FileMessage.qml b/resources/qml/delegates/FileMessage.qml

index 2ac2a80a..1e50fe3a 100644 --- a/resources/qml/delegates/FileMessage.qml +++ b/resources/qml/delegates/FileMessage.qml
@@ -11,11 +11,10 @@ Item { required property string eventId required property string filename required property string filesize - property int maxWidth height: row.height + 24 - width: maxWidth - implicitWidth: maxWidth + width: parent.width + implicitWidth: row.implicitWidth RowLayout { id: row diff --git a/resources/qml/delegates/ImageMessage.qml b/resources/qml/delegates/ImageMessage.qml
index 3bbcd077..a13bb4f6 100644 --- a/resources/qml/delegates/ImageMessage.qml +++ b/resources/qml/delegates/ImageMessage.qml
@@ -17,16 +17,11 @@ Item { required property string filename required property bool isReply required property string eventId - property int maxWidth - property double tempWidth: Math.min(maxWidth, originalWidth < 1 ? 200 : originalWidth) - property double tempHeight: tempWidth * proportionalHeight property double divisor: isReply ? 5 : 3 - property bool tooHigh: tempHeight > timelineView.height / divisor - height: Math.round(tooHigh ? timelineView.height / divisor : tempHeight) - width: Math.round(tooHigh ? (timelineView.height / divisor) / proportionalHeight : tempWidth) - implicitHeight: height - implicitWidth: width + implicitWidth: Math.round(originalWidth*Math.min((timelineView.height/divisor)/(originalWidth*proportionalHeight), 1)) + width: parent.width + height: width*proportionalHeight Image { id: blurhash_ diff --git a/resources/qml/delegates/MessageDelegate.qml b/resources/qml/delegates/MessageDelegate.qml
index 5d987841..3210128a 100644 --- a/resources/qml/delegates/MessageDelegate.qml +++ b/resources/qml/delegates/MessageDelegate.qml
@@ -35,9 +35,8 @@ Item { required property string callType required property int encryptionError required property int relatedEventCacheBuster - property int maxWidth - Layout.preferredHeight: chooser.child ? chooser.child.height : Nheko.paddingLarge + height: chooser.child ? chooser.child.height : Nheko.paddingLarge DelegateChooser { id: chooser @@ -46,8 +45,7 @@ Item { roleValue: type //anchors.fill: parent - anchors.left: parent.left - anchors.right: parent.right + width: parent.width? parent.width: 0 // this should get rid of "cannot read property 'width' of null" DelegateChoice { roleValue: MtxEvent.UnknownMessage @@ -111,7 +109,6 @@ Item { filename: d.filename isReply: d.isReply eventId: d.eventId - maxWidth: d.maxWidth } } @@ -129,7 +126,6 @@ Item { filename: d.filename isReply: d.isReply eventId: d.eventId - maxWidth: d.maxWidth } } @@ -141,7 +137,6 @@ Item { eventId: d.eventId filename: d.filename filesize: d.filesize - maxWidth: d.maxWidth } } @@ -158,7 +153,6 @@ Item { url: d.url body: d.body filesize: d.filesize - maxWidth: d.maxWidth } } @@ -175,7 +169,6 @@ Item { url: d.url body: d.body filesize: d.filesize - maxWidth: d.maxWidth } } @@ -184,7 +177,7 @@ Item { roleValue: MtxEvent.Redacted Redacted { - delegateWidth: d.width + //delegateWidth: d.width } } diff --git a/resources/qml/delegates/Pill.qml b/resources/qml/delegates/Pill.qml
index bfc18b9a..a3964f73 100644 --- a/resources/qml/delegates/Pill.qml +++ b/resources/qml/delegates/Pill.qml
@@ -11,8 +11,8 @@ Label { property bool isStateEvent color: Nheko.colors.text horizontalAlignment: Text.AlignHCenter - height: contentHeight * 1.2 - width: contentWidth * 1.2 + //height: contentHeight * 1.2 + //width: contentWidth * 1.2 font.pointSize: isStateEvent? 0.75*fontMetrics.font.pointSize : 1*fontMetrics.font.pointSize background: Rectangle { diff --git a/resources/qml/delegates/PlayableMediaMessage.qml b/resources/qml/delegates/PlayableMediaMessage.qml
index 805eafbf..9324cdaf 100644 --- a/resources/qml/delegates/PlayableMediaMessage.qml +++ b/resources/qml/delegates/PlayableMediaMessage.qml
@@ -22,16 +22,11 @@ Item { required property string url required property string body required property string filesize - property int maxWidth - property double tempWidth: Math.min(maxWidth, originalWidth < 1 ? 400 : originalWidth) - property double tempHeight: tempWidth * proportionalHeight property double divisor: isReply ? 4 : 2 - property bool tooHigh: tempHeight > timelineRoot.height / divisor - - height: (type == MtxEvent.VideoMessage ? tooHigh ? timelineRoot.height / divisor : tempHeight : 80) + fileInfoLabel.height - width: type == MtxEvent.VideoMessage ? tooHigh ? (timelineRoot.height / divisor) / proportionalHeight : tempWidth : 250 + implicitWidth: type == MtxEvent.VideoMessage ? Math.round(originalWidth*Math.min((timelineView.height/divisor)/(originalWidth*proportionalHeight), 1)) : 500 + width: parent.width + height: (type == MtxEvent.VideoMessage ? width*proportionalHeight : 80) + fileInfoLabel.height implicitHeight: height - implicitWidth: width MxcMedia { id: mxcmedia diff --git a/resources/qml/delegates/Redacted.qml b/resources/qml/delegates/Redacted.qml
index b0c9abfe..cf723988 100644 --- a/resources/qml/delegates/Redacted.qml +++ b/resources/qml/delegates/Redacted.qml
@@ -10,10 +10,10 @@ import im.nheko 1.0 Rectangle{ - required property real delegateWidth + //required property real delegateWidth height: redactedLayout.implicitHeight + Nheko.paddingSmall - width: redactedLayout.implicitWidth + 2 * Nheko.paddingMedium - implicitWidth: width + implicitWidth: redactedLayout.implicitWidth + 2 * Nheko.paddingMedium + //implicitWidth: width radius: fontMetrics.lineSpacing / 2 + 2 * Nheko.paddingSmall color: Nheko.colors.alternateBase @@ -33,8 +33,9 @@ Rectangle{ id: redactedLabel Layout.margins: 0 Layout.alignment: Qt.AlignVCenter | Qt.AlignRight - Layout.fillWidth: true - Layout.maximumWidth: delegateWidth - 4 * Nheko.paddingSmall - trashImg.width - 2 * Nheko.paddingMedium + Layout.preferredWidth: implicitWidth + //Layout.fillWidth: true + //Layout.maximumWidth: delegateWidth - 4 * Nheko.paddingSmall - trashImg.width - 2 * Nheko.paddingMedium property var redactedPair: room.formatRedactedEvent(eventId) text: redactedPair["first"] wrapMode: Label.WordWrap diff --git a/resources/qml/delegates/Reply.qml b/resources/qml/delegates/Reply.qml
index 28f0dd21..c60867de 100644 --- a/resources/qml/delegates/Reply.qml +++ b/resources/qml/delegates/Reply.qml
@@ -37,8 +37,8 @@ Item { property int relatedEventCacheBuster property int maxWidth - Layout.preferredHeight: replyContainer.height height: replyContainer.height + implicitHeight: replyContainer.height implicitWidth: visible? colorLine.width+replyContainer.implicitWidth : 0 CursorShape { @@ -99,6 +99,7 @@ Item { MessageDelegate { Layout.leftMargin: 4 + Layout.preferredHeight: height id: reply blurhash: r.blurhash body: r.body @@ -125,7 +126,6 @@ Item { enabled: false Layout.fillWidth: true isReply: true - maxWidth: r.maxWidth-4 } }