From 670f6771aa7f214d6a7318b24d0109a3f15eb73c Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Wed, 16 May 2018 13:37:04 +0200 Subject: [PATCH 5/6] [TabBar] Switch tabs with mouse wheel Makes it consistent with QTabWidget Differential Revision: https://phabricator.kde.org/D12923 --- org.kde.desktop/TabBar.qml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/org.kde.desktop/TabBar.qml b/org.kde.desktop/TabBar.qml index 57565d9..66609c1 100644 --- a/org.kde.desktop/TabBar.qml +++ b/org.kde.desktop/TabBar.qml @@ -66,7 +66,16 @@ T.TabBar { } } - background: Item { + background: MouseArea { + acceptedButtons: Qt.NoButton + onWheel: { + if (wheel.pixelDelta.y < 0 || wheel.angleDelta.y < 0) { + controlRoot.currentIndex = Math.min(controlRoot.currentIndex + 1, controlRoot.contentModel.count -1); + } else { + controlRoot.currentIndex = Math.max(controlRoot.currentIndex - 1, 0); + } + } + Rectangle { anchors { left: parent.left -- 2.14.3