Fix bad custom button alignments, sizings, etc.
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Fri, 18 Nov 2022 17:18:02 +0000 (18:18 +0100)
committerClaudio Cambra <claudio.cambra@gmail.com>
Thu, 24 Nov 2022 16:46:20 +0000 (17:46 +0100)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
src/gui/tray/ActivityActionButton.qml
src/gui/tray/ActivityItem.qml
src/gui/tray/CustomButton.qml
src/gui/tray/NCButtonContents.qml
theme/Style/Style.qml

index d13cb08362b56be22161524cb52423b1616bfad7..6693153b77debad838bf87725cec87e2e901a0b7 100644 (file)
@@ -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
index eb06c7213c39e858acc03d648fa677d48b13585f..09e847a78a1981b2f27a922a142abd0c0a15571f 100644 (file)
@@ -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
index 3cdfd1491432e5727ef5d6b66ef2796214ac9b52..dfd3a6554f41ec420d50c1aef2edec2d068f4392 100644 (file)
@@ -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 {
index 42fbd52ffdddca7fdcea05ff08b1a557f191012d..2ca45fd191c0af0864bda9c996bce2d521fb16d0 100644 (file)
@@ -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
@@ -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
index 06008acb3679daa661bf8cb52fce7472baacdc9d..5c0453fe6f3c978cc023a477015d36e817c95dde 100644 (file)
@@ -53,6 +53,7 @@ QtObject {
     property int smallSpacing: 5\r
 \r
     property int iconButtonWidth: 36\r
+    property int standardPrimaryButtonHeight: 40\r
 \r
     property int minActivityHeight: variableSize(40)\r
 \r