Skip to content

Commit

Permalink
Fix bad custom button alignments, sizings, etc.
Browse files Browse the repository at this point in the history
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
  • Loading branch information
claucambra committed Nov 18, 2022
1 parent 01f8003 commit 002911a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 2 additions & 0 deletions src/gui/tray/ActivityActionButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ AbstractButton {
property string verb: ""
property bool isTalkReplyButton: false

leftPadding: root.text === "" ? Style.smallSpacing : Style.standardSpacing
rightPadding: root.text === "" ? Style.smallSpacing : Style.standardSpacing

background: NCButtonBackground {
color: Style.currentUserHeaderColor
Expand Down
2 changes: 1 addition & 1 deletion src/gui/tray/ActivityItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ ItemDelegate {

Layout.fillWidth: true
Layout.leftMargin: Style.trayListItemIconSize + activityContent.spacing
Layout.minimumHeight: Style.minActivityHeight
Layout.preferredHeight: Style.standardPrimaryButtonHeight

displayActions: model.displayActions
objectType: model.objectType
Expand Down
4 changes: 2 additions & 2 deletions src/gui/tray/CustomButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ Button {
hovered: root.hovered
}

leftPadding: root.text === "" ? 5 : 10
rightPadding: root.text === "" ? 5 : 10
leftPadding: root.text === "" ? Style.smallSpacing : Style.standardSpacing
rightPadding: root.text === "" ? Style.smallSpacing : Style.standardSpacing
implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding

NCToolTip {
Expand Down
10 changes: 6 additions & 4 deletions src/gui/tray/NCButtonContents.qml
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,19 @@ RowLayout {
Image {
id: icon

Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
Layout.fillWidth: !buttonLabel.visible

source: root.hovered ? root.imageSourceHover : root.imageSource
fillMode: Image.PreserveAspectFit
horizontalAlignment: Image.AlignHCenter
verticalAlignment: Image.AlignVCenter
visible: root.hovered ? root.imageSourceHover !== "" : root.imageSource !== ""
}

Label {
id: buttonLabel

Layout.maximumWidth: icon.width > 0 ? parent.width - icon.width - parent.spacing : parent.width
Layout.fillWidth: icon.status !== Image.Ready
Layout.fillWidth: true

text: root.text
textFormat: Text.PlainText
Expand All @@ -52,7 +54,7 @@ RowLayout {

color: root.hovered ? root.textColorHovered : root.textColor

horizontalAlignment: Text.AlignHCenter
horizontalAlignment: icon.visible ? Text.AlignLeft : Text.AlignHCenter
verticalAlignment: Text.AlignVCenter

elide: Text.ElideRight
Expand Down

0 comments on commit 002911a

Please sign in to comment.