Respect icon.height and width in custom button contents
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Fri, 19 May 2023 14:38:30 +0000 (22:38 +0800)
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>
Tue, 30 May 2023 08:40:51 +0000 (08:40 +0000)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
src/gui/tray/CustomButton.qml
src/gui/tray/NCButtonContents.qml

index 08ae77e9723fb29f09ecb04468d1057b77fba250..e7a4fd6c75cc5ec3b2cb9f3076fcac32863dbdff 100644 (file)
@@ -56,6 +56,8 @@ Button {
         hovered: root.hovered
         imageSourceHover: root.imageSourceHover
         imageSource: root.icon.source
+        imageSourceWidth: root.icon.width
+        imageSourceHeight: root.icon.height
         text: root.text
         textColor: root.textColor
         textColorHovered: root.textColorHovered
index 4247481b6be4171114d00807ca58f8bc6a1be7b7..a2f0afb7976d9630d66c7a5f0a2ddbdff417f809 100644 (file)
@@ -24,6 +24,8 @@ RowLayout {
     property bool hovered: false
     property string imageSourceHover: ""
     property string imageSource: ""
+    property int imageSourceWidth: 64
+    property int imageSourceHeight: 64
     property string text: ""
     property var display
 
@@ -38,6 +40,12 @@ RowLayout {
         Layout.maximumHeight: root.height
 
         source: root.hovered ? root.imageSourceHover : root.imageSource
+
+        sourceSize {
+            width: root.imageSourceWidth
+            height: root.imageSourceHeight
+        }
+
         fillMode: Image.PreserveAspectFit
         horizontalAlignment: Image.AlignHCenter
         verticalAlignment: Image.AlignVCenter