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: { 0021 // Magic number 120 for common "one click" 0022 // See: https://qt-project.org/doc/qt-5/qml-qtquick-wheelevent.html#angleDelta-prop 0023 var delta = wheel.angleDelta.y || wheel.angleDelta.x; 0024 wheelDelta += delta; 0025 while (wheelDelta >= 120) { 0026 wheelDelta -= 120; 0027 keyboardLayout.switchToPreviousLayout(); 0028 } 0029 while (wheelDelta <= -120) { 0030 wheelDelta += 120; 0031 keyboardLayout.switchToNextLayout(); 0032 } 0033 } 0034 0035 KeyboardLayout { 0036 id: keyboardLayout 0037 } 0038 }