[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [lightdm] themes/userbar: Use the repeater info to enumerate items
From:       Aurélien Gâteau <aurelien.gateau () canonical ! com>
Date:       2012-04-17 22:20:11
Message-ID: 20120417222011.DF5D1A60A9 () git ! kde ! org
[Download RAW message or body]

Git commit ce23a19f10be9fcfe8147f2dc718ffce3f7ee26b by Aurélien Gâteau.
Committed on 18/04/2012 at 00:16.
Pushed by gateau into branch 'master'.

Use the repeater info to enumerate items

Avoid bug where pressing down key on last item would select nothing

M  +7    -7    themes/userbar/ListButton.qml

http://commits.kde.org/lightdm/ce23a19f10be9fcfe8147f2dc718ffce3f7ee26b

diff --git a/themes/userbar/ListButton.qml b/themes/userbar/ListButton.qml
index 996958f..6feff26 100644
--- a/themes/userbar/ListButton.qml
+++ b/themes/userbar/ListButton.qml
@@ -27,19 +27,19 @@ FocusScope {
     property alias model: repeater.model
 
     function itemData(index) {
-        var button = column.children[index];
+        var button = repeater.itemAt(index);
         return button.data;
     }
 
     function itemText(index) {
-        var button = column.children[index];
+        var button = repeater.itemAt(index);
         return button.text;
     }
 
     function indexForData(data) {
         var index;
-        for (index = 0; index < column.children.length; ++index) {
-            if (column.children[index].data == data) {
+        for (index = 0; index < repeater.count; ++index) {
+            if (repeater.itemAt(index).data == data) {
                 return index;
             }
         }
@@ -48,8 +48,8 @@ FocusScope {
 
     function indexForItem(item) {
         var index;
-        for (index = 0; index < column.children.length; ++index) {
-            if (column.children[index] == item) {
+        for (index = 0; index < repeater.count; ++index) {
+            if (repeater.itemAt(index) == item) {
                 return index;
             }
         }
@@ -150,7 +150,7 @@ FocusScope {
         }
     }
     Keys.onDownPressed: {
-        if (root.currentIndex < column.children.length - 1) {
+        if (root.currentIndex < repeater.count - 1) {
             root.currentIndex++;
         }
     }

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic