Changeset View
Changeset View
Standalone View
Standalone View
src/kcm/package/contents/ui/main.qml
Show All 20 Lines | |||||
21 | import QtQuick 2.1 | 21 | import QtQuick 2.1 | ||
22 | import QtQuick.Controls 1.3 | 22 | import QtQuick.Controls 1.3 | ||
23 | 23 | | |||
24 | import org.kde.kcm 1.0 | 24 | import org.kde.kcm 1.0 | ||
25 | import org.kde.plasma.core 2.0 as PlasmaCore /* for units.gridUnit */ | 25 | import org.kde.plasma.core 2.0 as PlasmaCore /* for units.gridUnit */ | ||
26 | 26 | | |||
27 | import org.kde.plasma.private.volume 0.1 | 27 | import org.kde.plasma.private.volume 0.1 | ||
28 | 28 | | |||
29 | TabView { | 29 | MouseArea { | ||
30 | property int wheelDelta: 0 | ||||
30 | property QtObject sinkModel: SinkModel { } | 31 | property QtObject sinkModel: SinkModel { } | ||
31 | property QtObject sourceModel: SourceModel { } | 32 | property QtObject sourceModel: SourceModel { } | ||
32 | 33 | | |||
34 | acceptedButtons: Qt.NoButton | ||||
33 | implicitWidth: units.gridUnit * 30 | 35 | implicitWidth: units.gridUnit * 30 | ||
34 | implicitHeight: units.gridUnit * 30 | 36 | implicitHeight: units.gridUnit * 30 | ||
35 | 37 | | |||
36 | ConfigModule.quickHelp: i18n("This module allows to set up the Pulseaudio sound subsystem.") | 38 | ConfigModule.quickHelp: i18n("This module allows to set up the Pulseaudio sound subsystem.") | ||
37 | 39 | | |||
40 | onWheel: { | ||||
41 | var delta = wheel.angleDelta.y || wheel.angleDelta.x; | ||||
42 | wheelDelta += delta; | ||||
43 | // Magic number 120 for common "one click" | ||||
44 | // See: http://qt-project.org/doc/qt-5/qml-qtquick-wheelevent.html#angleDelta-prop | ||||
45 | while (wheelDelta >= 120) { | ||||
46 | wheelDelta -= 120; | ||||
47 | tabView.currentIndex = Math.max(0, tabView.currentIndex - 1); | ||||
48 | } | ||||
49 | while (wheelDelta <= -120) { | ||||
50 | wheelDelta += 120; | ||||
51 | tabView.currentIndex = Math.min(tabView.count - 1, tabView.currentIndex + 1); | ||||
52 | } | ||||
53 | } | ||||
54 | | ||||
55 | TabView { | ||||
56 | id: tabView | ||||
57 | anchors.fill: parent | ||||
58 | | ||||
38 | Tab { | 59 | Tab { | ||
broulik: Could you just make the root Item a MouseArea instead? | |||||
39 | title: i18nc("@title:tab", "Devices") | 60 | title: i18nc("@title:tab", "Devices") | ||
40 | Devices {} | 61 | Devices {} | ||
41 | } | 62 | } | ||
42 | Tab { | 63 | Tab { | ||
43 | title: i18nc("@title:tab", "Applications") | 64 | title: i18nc("@title:tab", "Applications") | ||
44 | Applications {} | 65 | Applications {} | ||
45 | } | 66 | } | ||
46 | Tab { | 67 | Tab { | ||
47 | title: i18nc("@title:tab", "Advanced") | 68 | title: i18nc("@title:tab", "Advanced") | ||
48 | Advanced {} | 69 | Advanced {} | ||
49 | } | 70 | } | ||
50 | } | 71 | } | ||
72 | } |
Could you just make the root Item a MouseArea instead?