Fix alignment of predefined status contents regardless of emoji fonts
authorClaudio Cambra <claudio.cambra@gmail.com>
Wed, 10 Aug 2022 18:18:11 +0000 (20:18 +0200)
committerClaudio Cambra <claudio.cambra@gmail.com>
Wed, 17 Aug 2022 18:01:12 +0000 (20:01 +0200)
Signed-off-by: Claudio Cambra <claudio.cambra@gmail.com>
src/gui/PredefinedStatusButton.qml
src/gui/UserStatusSelector.qml

index 3186bb5e12cda7071fb15decaeedf3b50bd6c380..dabef84ae236e4cbe174032c1de53c0dbe9b5be0 100644 (file)
@@ -28,7 +28,8 @@ AbstractButton {
     leftPadding: Style.standardSpacing / 2
     rightPadding: Style.standardSpacing / 2
 
-    property real internalSpacing: Style.standardSpacing
+    property int emojiWidth: -1
+    property int internalSpacing: Style.standardSpacing
     property string emoji: ""
 
     background: Rectangle {
@@ -37,15 +38,19 @@ AbstractButton {
     }
 
     contentItem: Row {
-        spacing: internalSpacing
+        spacing: root.internalSpacing
 
         Label {
+            width: root.emojiWidth > 0 ? root.emojiWidth : implicitWidth
             text: emoji
+            horizontalAlignment: Image.AlignHCenter
+            verticalAlignment: Image.AlignVCenter
         }
 
         Label {
             text: root.text
             color: Style.ncTextColor
+            verticalAlignment: Text.AlignVCenter
         }
     }
 }
index 68809ae4bd907b170d3e5f9d1e07fb06ab4956c6..482505769c4a93d07758b9a9700c379e70e6b693 100644 (file)
@@ -141,6 +141,7 @@ ColumnLayout {
             }
 
             RowLayout {
+                id: statusFieldLayout
                 Layout.fillWidth: true
                 spacing: 0
 
@@ -264,9 +265,11 @@ ColumnLayout {
                     model: userStatusSelectorModel.predefinedStatuses
 
                     PredefinedStatusButton {
-                        id: control
                         Layout.fillWidth: true
-                        internalSpacing: Style.standardSpacing + fieldButton.padding + userStatusMessageTextField.padding
+
+                        leftPadding: 0
+                        emojiWidth: fieldButton.width
+                        internalSpacing: statusFieldLayout.spacing + userStatusMessageTextField.leftPadding
 
                         emoji: modelData.icon
                         text: "<b>%1</b> – %2".arg(modelData.message).arg(userStatusSelectorModel.clearAtReadable(modelData))