From f747f370b339762fb83f1efb0ab3044acc696976 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 3 Jun 2014 14:16:05 +0200 Subject: [PATCH] [tabbox] Fix key navigation in icons based tabbox --- tabbox/qml/IconTabBox.qml | 18 ++++++------------ .../qml/clients/big_icons/contents/ui/main.qml | 12 ++++++++++++ .../clients/small_icons/contents/ui/main.qml | 12 ++++++++++++ 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/tabbox/qml/IconTabBox.qml b/tabbox/qml/IconTabBox.qml index c56bc241ba..589d3da7e2 100644 --- a/tabbox/qml/IconTabBox.qml +++ b/tabbox/qml/IconTabBox.qml @@ -23,6 +23,12 @@ import org.kde.kquickcontrolsaddons 2.0 Item { id: iconsTabBox + function decrementCurrentIndex() { + iconsListView.decrementCurrentIndex(); + } + function incrementCurrentIndex() { + iconsListView.incrementCurrentIndex(); + } property int iconSize property alias count: iconsListView.count property alias margins: hoverItem.margins @@ -92,16 +98,4 @@ Item { highlightMoveDuration: 250 boundsBehavior: Flickable.StopAtBounds } - /* - * Key navigation on outer item for two reasons: - * @li we have to emit the change signal - * @li on multiple invocation it does not work on the list view. Focus seems to be lost. - **/ - Keys.onPressed: { - if (event.key == Qt.Key_Left) { - iconsListView.decrementCurrentIndex(); - } else if (event.key == Qt.Key_Right) { - iconsListView.incrementCurrentIndex(); - } - } } diff --git a/tabbox/qml/clients/big_icons/contents/ui/main.qml b/tabbox/qml/clients/big_icons/contents/ui/main.qml index 241c9f208b..74cef21ae0 100644 --- a/tabbox/qml/clients/big_icons/contents/ui/main.qml +++ b/tabbox/qml/clients/big_icons/contents/ui/main.qml @@ -102,6 +102,18 @@ KWin.Switcher { } } } + /* + * Key navigation on outer item for two reasons: + * @li we have to emit the change signal + * @li on multiple invocation it does not work on the list view. Focus seems to be lost. + **/ + Keys.onPressed: { + if (event.key == Qt.Key_Left) { + icons.decrementCurrentIndex(); + } else if (event.key == Qt.Key_Right) { + icons.incrementCurrentIndex(); + } + } } } } diff --git a/tabbox/qml/clients/small_icons/contents/ui/main.qml b/tabbox/qml/clients/small_icons/contents/ui/main.qml index 03e2b617f0..ec4a4d769e 100644 --- a/tabbox/qml/clients/small_icons/contents/ui/main.qml +++ b/tabbox/qml/clients/small_icons/contents/ui/main.qml @@ -83,6 +83,18 @@ KWin.Switcher { } } } + /* + * Key navigation on outer item for two reasons: + * @li we have to emit the change signal + * @li on multiple invocation it does not work on the list view. Focus seems to be lost. + **/ + Keys.onPressed: { + if (event.key == Qt.Key_Left) { + icons.decrementCurrentIndex(); + } else if (event.key == Qt.Key_Right) { + icons.incrementCurrentIndex(); + } + } } } }