diff options
author | J-P Nurmi <jpnurmi@digia.com> | 2013-08-07 10:08:01 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-08-07 10:52:56 +0200 |
commit | b9936b9628b5cc450290186159c3e3fe7485ab22 (patch) | |
tree | 78a69cce1f6cc3e0a51349639fb75ff079c2e4f0 | |
parent | 19c9ad7f109a8358c66008517b7535d99237424e (diff) | |
download | qtquickcontrols-b9936b9628b5cc450290186159c3e3fe7485ab22.tar.gz |
Base/ToolButtonStyle: fix panel's implicit size for textual buttons
Change-Id: Id94be2cf585750c6004d78c0e1b808f30a281bb2
Reviewed-by: Caroline Chao <caroline.chao@digia.com>
-rw-r--r-- | src/styles/Base/ToolButtonStyle.qml | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/styles/Base/ToolButtonStyle.qml b/src/styles/Base/ToolButtonStyle.qml index d6de68e0..280740e4 100644 --- a/src/styles/Base/ToolButtonStyle.qml +++ b/src/styles/Base/ToolButtonStyle.qml @@ -51,8 +51,10 @@ Style { readonly property ToolButton control: __control property Component panel: Item { id: styleitem - implicitWidth: 36 - implicitHeight: 36 + implicitWidth: hasIcon ? 36 : Math.max(label.implicitWidth + frame.border.left + frame.border.right, 36) + implicitHeight: hasIcon ? 36 : Math.max(label.implicitHeight, 36) + + readonly property bool hasIcon: icon.status === Image.Ready || icon.status === Image.Loading Rectangle { anchors.fill: parent @@ -63,7 +65,7 @@ Style { } Text { id: label - visible: icon.status != Image.Ready + visible: !hasIcon anchors.centerIn: parent text: control.text } @@ -73,6 +75,7 @@ Style { source: control.iconSource } BorderImage { + id: frame anchors.fill: parent anchors.margins: -1 anchors.topMargin: -2 |