DelegateBase: fixed settign buttons loader height and visibility when there is no...
authorSami Rämö <sami.ramo@ixonos.com>
Wed, 17 Nov 2010 07:49:13 +0000 (09:49 +0200)
committerJanne Kiiski <janne.kiiski@ixonos.com>
Wed, 17 Nov 2010 10:16:19 +0000 (12:16 +0200)
src/qmlui/DelegateBase.qml

index 25f140f..6f47441 100644 (file)
@@ -93,20 +93,22 @@ Item {
             when: delegate.ListView.isCurrentItem
             PropertyChanges {
                 target: buttons
-                height: buttons.item.childrenRect.height
+                height: buttons.status == Loader.Ready ? buttons.item.childrenRect.height : 0
                 explicit: true
             }
         },
         State {
             name: ""
             when: !delegate.ListView.isCurrentItem
-            PropertyChanges {
-                target: buttons.item
-                visible: false
-            }
         }
     ]
 
+    onStateChanged: {
+        if (buttons.status == Loader.Ready) {
+            buttons.item.visible = (state == "expanded")
+        }
+    }
+
     transitions: [
         Transition {
             from: ""
@@ -114,7 +116,6 @@ Item {
 //            NumberAnimation { properties: "height"; duration: 100 }
             PropertyAction { target: primaryText; property: "wrapMode"; value: Text.Wrap }
             PropertyAction { target: primaryText; property: "elide"; value: Text.ElideNone }
-            PropertyAction { target: buttons.item; property: "visible"; value: true }
             reversible: true
         }
     ]