Respect icon.height and width in custom button contents

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2023-05-19 22:38:30 +08:00 committed by Matthieu Gallien
parent ea43ebfe91
commit 93efd2fb78
2 changed files with 10 additions and 0 deletions

View 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

View 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