From bbb872e5dca1af9c9a11e7196cbf10d80a8f17db Mon Sep 17 00:00:00 2001 From: miruka Date: Mon, 2 Dec 2019 04:40:01 -0400 Subject: [PATCH] Improve HButton behavior on small fixed size --- src/qml/Base/HButton.qml | 11 ++++++----- src/qml/Base/HButtonContent.qml | 2 ++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/qml/Base/HButton.qml b/src/qml/Base/HButton.qml index 4566c0ea..05e8fcc9 100644 --- a/src/qml/Base/HButton.qml +++ b/src/qml/Base/HButton.qml @@ -4,12 +4,12 @@ import QtQuick.Layouts 1.12 Button { id: button - spacing: theme.spacing - topPadding: spacing / (circle ? 1.75 : 1.5) - bottomPadding: topPadding - leftPadding: spacing / (circle ? 1.5 : 1) - rightPadding: leftPadding enabled: ! button.loading + spacing: theme.spacing + topPadding: padded ? spacing / (circle ? 1.75 : 1.5) : 0 + bottomPadding: topPadding + leftPadding: padded ? spacing / (circle ? 1.5 : 1) : 0 + rightPadding: leftPadding iconItem.svgName: loading ? "hourglass" : icon.name icon.color: theme.icons.colorize @@ -35,6 +35,7 @@ Button { property bool disableWhileLoading: true property bool loading: false property bool circle: false + property bool padded: true property HToolTip toolTip: HToolTip { id: toolTip diff --git a/src/qml/Base/HButtonContent.qml b/src/qml/Base/HButtonContent.qml index 2ffb75af..76f9bdf9 100644 --- a/src/qml/Base/HButtonContent.qml +++ b/src/qml/Base/HButtonContent.qml @@ -21,6 +21,7 @@ HRowLayout { Item { id: iconWrapper + Layout.alignment: Qt.AlignCenter Layout.preferredWidth: icon.width Layout.preferredHeight: icon.height @@ -92,6 +93,7 @@ HRowLayout { verticalAlignment: Text.AlignVCenter elide: Text.ElideRight + Layout.alignment: Qt.AlignCenter Layout.fillWidth: true Layout.fillHeight: true }