From 9303301e838e5aac7b9204b91ada66b06512ba0a Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Thu, 10 Nov 2011 14:29:39 +0100 Subject: [PATCH] square button if icon only --- declarativeimports/plasmacomponents/qml/Button.qml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/declarativeimports/plasmacomponents/qml/Button.qml b/declarativeimports/plasmacomponents/qml/Button.qml index fb24e00cf..1f75caa3a 100644 --- a/declarativeimports/plasmacomponents/qml/Button.qml +++ b/declarativeimports/plasmacomponents/qml/Button.qml @@ -35,7 +35,13 @@ Item { signal clicked() - width: Math.max(theme.defaultFont.mSize.width*12, icon.width + label.paintedWidth + surfaceNormal.margins.left + surfaceNormal.margins.right) + ((icon.valid) ? surfaceNormal.margins.left : 0); + width: { + if (label.paintedWidth == 0) { + return height + } else { + return Math.max(theme.defaultFont.mSize.width*12, icon.width + label.paintedWidth + surfaceNormal.margins.left + surfaceNormal.margins.right) + ((icon.valid) ? surfaceNormal.margins.left : 0) + } + } height: Math.max(theme.defaultFont.mSize.height*1.8, Math.max(icon.height, label.paintedHeight) + surfaceNormal.margins.top + surfaceNormal.margins.bottom) // TODO: needs to define if there will be specific graphics for