Warning, /plasma/plasma-workspace/components/workspace/KeyboardLayoutSwitcher.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2014 Daniel Vrátil <dvratil@redhat.com> 0003 SPDX-FileCopyrightText: 2020 Andrey Butirsky <butirsky@gmail.com> 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 2.12 0008 import org.kde.plasma.workspace.keyboardlayout 1.0 0009 0010 MouseArea { 0011 property alias keyboardLayout: keyboardLayout 0012 readonly property bool hasMultipleKeyboardLayouts: keyboardLayout.layoutsList.length > 1 0013 readonly property var layoutNames: keyboardLayout.layoutsList.length ? keyboardLayout.layoutsList[keyboardLayout.layout] 0014 : { shortName: "", displayName: "", longName: "" } 0015 0016 onClicked: keyboardLayout.switchToNextLayout() 0017 0018 property int wheelDelta: 0 0019 0020 onWheel: wheel => { 0021 // Magic number 120 for common "one click" 0022 // See: https://qt-project.org/doc/qt-5/qml-qtquick-wheelevent.html#angleDelta-prop 0023 wheelDelta += (wheel.inverted ? -1 : 1) * (wheel.angleDelta.y ? wheel.angleDelta.y : wheel.angleDelta.x); 0024 while (wheelDelta >= 120) { 0025 wheelDelta -= 120; 0026 keyboardLayout.switchToPreviousLayout(); 0027 } 0028 while (wheelDelta <= -120) { 0029 wheelDelta += 120; 0030 keyboardLayout.switchToNextLayout(); 0031 } 0032 } 0033 0034 KeyboardLayout { 0035 id: keyboardLayout 0036 } 0037 }