0.9.3-1 release
[ubi] / qml / ubi / components / Button.qml
index 77402fa..32b75e0 100644 (file)
@@ -5,6 +5,7 @@ Item {
     id: root
     property string label
     property bool disabled: false
+    property int fontSize: 30
     property int maxSize: 27
     property string iconSource
 
@@ -26,8 +27,8 @@ Item {
     Rectangle {
         id: box
         color: root.disabled ? Const.COOL_GREY_COLOR : "black"
-        height: textbox.height+20
-        width: textbox.width<100 ? 120 : textbox.width+20
+        height: root.iconSource=="" ? textbox.height+20 : icon.height+20
+        width: root.iconSource=="" ? textbox.width+30 : icon.width+30
         radius: 10
     }
 
@@ -39,14 +40,12 @@ Item {
         color: Const.WARM_GREY_COLOR
         radius: 10
         visible: root.state == "pressed"
-        //border.color: "black"
-        //border.width: Const.SHADOW_OFFSET
     }
 
     Image {
         id: icon
-        width: 40
-        height: 40
+        //width: 30
+        //height: 30
         anchors.centerIn: box
         source: root.iconSource == "" ? "" : "../" + root.iconSource
         sourceSize.width: width
@@ -55,9 +54,6 @@ Item {
 
     onLabelChanged: {
         if(root.label.length>root.maxSize) {
-            console.log("root.label: "+root.label)
-            console.log("root.label.length: "+root.label.length)
-            console.log("root.maxSize: "+root.maxSize)
             textbox.text = root.label.substring(0,root.maxSize-3)+"...";
         } else {
             textbox.text = root.label;
@@ -66,9 +62,7 @@ Item {
 
     Text {
         id: textbox
-        //x: 10
-        //y: 10
-        font.pixelSize: 30
+        font.pixelSize: root.fontSize
         color: root.disabled ? "gray" : "white"
         anchors.centerIn: box
         visible: root.iconSource == ""