From 23fbdc089a70be84997fecc01033604f2cb9c5a0 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Wed, 26 Sep 2012 18:16:17 +0200 Subject: [PATCH] fix in case some tab is invisible --- .../qml/private/TabBarLayout.qml | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/declarativeimports/plasmacomponents/qml/private/TabBarLayout.qml b/declarativeimports/plasmacomponents/qml/private/TabBarLayout.qml index 9d3804275..e4c640eae 100644 --- a/declarativeimports/plasmacomponents/qml/private/TabBarLayout.qml +++ b/declarativeimports/plasmacomponents/qml/private/TabBarLayout.qml @@ -69,14 +69,22 @@ Item { if (event.key == Qt.Key_Right || event.key == Qt.Key_Left) { var oldIndex = priv.currentButtonIndex(); if (event.key == Qt.Key_Right || priv.mirrored) { - if (oldIndex != root.children.length - 1) { - priv.setCurrentButtonIndex(oldIndex + 1) - event.accepted = true + while (oldIndex < root.children.length - 1) { + ++oldIndex + if (root.children[oldIndex].visible) { + priv.setCurrentButtonIndex(oldIndex) + event.accepted = true + break + } } } else if (event.key == Qt.Key_Left || priv.mirrored) { - if (oldIndex != 0) { - priv.setCurrentButtonIndex(oldIndex -1) - event.accepted = true + while (oldIndex > 0) { + --oldIndex + if (root.children[oldIndex].visible) { + priv.setCurrentButtonIndex(oldIndex) + event.accepted = true + break + } } } }