Переглянути джерело

Respect icon.height and width in custom button contents

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
Claudio Cambra 2 роки тому
батько
коміт
29ddf1a86d
2 змінених файлів з 10 додано та 0 видалено
  1. 2 0
      src/gui/tray/CustomButton.qml
  2. 8 0
      src/gui/tray/NCButtonContents.qml

+ 2 - 0
src/gui/tray/CustomButton.qml

@@ -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

+ 8 - 0
src/gui/tray/NCButtonContents.qml

@@ -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