Skip to content

Commit

Permalink
Fix alignment of predefined status contents regardless of emoji fonts
Browse files Browse the repository at this point in the history
Signed-off-by: Claudio Cambra <claudio.cambra@gmail.com>
  • Loading branch information
claucambra committed Aug 10, 2022
1 parent ddcb834 commit 735cee2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
9 changes: 7 additions & 2 deletions src/gui/PredefinedStatusButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
}
}
}
7 changes: 5 additions & 2 deletions src/gui/UserStatusSelector.qml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ ColumnLayout {
}

RowLayout {
id: statusFieldLayout
Layout.fillWidth: true
spacing: 0

Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 735cee2

Please sign in to comment.