From 24008be92255599d5c14b41d447559c72d4d32bf Mon Sep 17 00:00:00 2001
From: Caroline Chao <caroline.chao@digia.com>
Date: Wed, 20 Feb 2013 12:13:00 +0100
Subject: [PATCH] ToolButton: Fix text not visible

iconSource is an url so it needs to be converted to
a string when used with the non-coerning test checking
if it is an empty string or not. Otherwise it is always false
and the text item never visible.

Add ToolButton to the manual test tool TestBench.

Change-Id: I1099bb4c7c10565e3f40588c82015ae54be42e20
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
---
 src/styles/Desktop/ToolButtonStyle.qml        | 2 +-
 tests/manual/testbench/content/Components.qml | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/styles/Desktop/ToolButtonStyle.qml b/src/styles/Desktop/ToolButtonStyle.qml
index 33b03d1a6..69099586d 100644
--- a/src/styles/Desktop/ToolButtonStyle.qml
+++ b/src/styles/Desktop/ToolButtonStyle.qml
@@ -69,7 +69,7 @@ Style {
             id: textitem
             text: control.text
             anchors.centerIn: parent
-            visible: control.iconSource === ""
+            visible: control.iconSource.toString() === ""
         }
     }
 }
diff --git a/tests/manual/testbench/content/Components.qml b/tests/manual/testbench/content/Components.qml
index 07d0acb02..985e0dadc 100644
--- a/tests/manual/testbench/content/Components.qml
+++ b/tests/manual/testbench/content/Components.qml
@@ -44,6 +44,7 @@ import QtDesktop 1.0
 Item {
     property Component button: Button { text: "Push me"}
     property Component checkbox: CheckBox { text: "A CheckBox" }
+    property Component toolbutton: ToolButton { text: "A ToolButton" }
     property Component radiobutton: RadioButton { text: "A RadioButton" }
     property Component textfield: TextField { }
     property Component spinbox: SpinBox {}
@@ -96,6 +97,7 @@ Item {
     property var componentModel: ListModel {
         Component.onCompleted: {
             append({ name: "Button",        component: button});
+            append({ name: "ToolButton",    component: toolbutton});
             append({ name: "CheckBox",      component: checkbox});
             append({ name: "ComboBox",      component: combobox});
             append({ name: "RadioButton",   component: radiobutton});
@@ -107,7 +109,7 @@ Item {
             append({ name: "ToolBar",       component: toolbar});
             append({ name: "StatusBar",     component: statusbar});
             append({ name: "TableView",     component: tableview});
-            append({ name: "ScrollArea",     component: scrollarea});
+            append({ name: "ScrollArea",    component: scrollarea});
         }
     }
 }
-- 
GitLab