Fix layout of tags with differing sizes and oversized tags
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Wed, 12 Apr 2023 04:11:33 +0000 (12:11 +0800)
committerClaudio Cambra <claudio.cambra@nextcloud.com>
Tue, 16 May 2023 10:23:33 +0000 (18:23 +0800)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
src/gui/filedetails/FileDetailsPage.qml

index 1982beffbeaf1d1426053e0785b51cc50d75c6f5..ff43acb04f12a64fe663892684f36b0fb6fe320e 100644 (file)
@@ -167,7 +167,7 @@ Page {
                 visible: headerGridLayout.showFileLockedString
             }
 
-            RowLayout {
+            Row {
                 id: tagRow
 
                 Layout.fillWidth: true
@@ -177,9 +177,14 @@ Page {
                     id: tagRepeater
 
                     readonly property var fileTagModel: root.fileDetails.fileTagModel
+                    readonly property int maxTags: 3
 
                     model: fileTagModel
                     delegate: FileTag {
+                        readonly property int availableLayoutSpace: tagRow.width - tagRow.spacing - overflowTag.width
+                        readonly property int maxWidth: (availableLayoutSpace / tagRepeater.maxTags) - tagRow.spacing
+
+                        width: Math.min(maxWidth, implicitWidth)
                         text: model.display
                     }