From kde-commits Tue Apr 17 22:20:11 2012 From: =?utf-8?b?QXVyw6lsaWVuIEfDonRlYXU=?= Date: Tue, 17 Apr 2012 22:20:11 +0000 To: kde-commits Subject: [lightdm] themes/userbar: Use the repeater info to enumerate items Message-Id: <20120417222011.DF5D1A60A9 () git ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=133470132926345 Git commit ce23a19f10be9fcfe8147f2dc718ffce3f7ee26b by Aur=C3=A9lien G=C3= =A2teau. 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 =3D column.children[index]; + var button =3D repeater.itemAt(index); return button.data; } = function itemText(index) { - var button =3D column.children[index]; + var button =3D repeater.itemAt(index); return button.text; } = function indexForData(data) { var index; - for (index =3D 0; index < column.children.length; ++index) { - if (column.children[index].data =3D=3D data) { + for (index =3D 0; index < repeater.count; ++index) { + if (repeater.itemAt(index).data =3D=3D data) { return index; } } @@ -48,8 +48,8 @@ FocusScope { = function indexForItem(item) { var index; - for (index =3D 0; index < column.children.length; ++index) { - if (column.children[index] =3D=3D item) { + for (index =3D 0; index < repeater.count; ++index) { + if (repeater.itemAt(index) =3D=3D 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++; } }