diff options
author | Nicolas Lécureuil <neoclust@mageia.org> | 2021-02-14 18:00:48 +0100 |
---|---|---|
committer | Nicolas Lécureuil <neoclust@mageia.org> | 2021-02-14 18:00:48 +0100 |
commit | 828de2993de509f8805eb63d203e4c0ee9fdb3fa (patch) | |
tree | 2ab75ad165d0af597de666dadb1857ffed172c73 /KeyboardButton.qml | |
download | mageia-sddm-828de2993de509f8805eb63d203e4c0ee9fdb3fa.tar mageia-sddm-828de2993de509f8805eb63d203e4c0ee9fdb3fa.tar.gz mageia-sddm-828de2993de509f8805eb63d203e4c0ee9fdb3fa.tar.bz2 mageia-sddm-828de2993de509f8805eb63d203e4c0ee9fdb3fa.tar.xz mageia-sddm-828de2993de509f8805eb63d203e4c0ee9fdb3fa.zip |
Initial commit
Diffstat (limited to 'KeyboardButton.qml')
-rw-r--r-- | KeyboardButton.qml | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/KeyboardButton.qml b/KeyboardButton.qml new file mode 100644 index 0000000..d5d5a44 --- /dev/null +++ b/KeyboardButton.qml @@ -0,0 +1,37 @@ +import QtQuick 2.2 + +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents // Because PC3 ToolButton can't take a menu + +import QtQuick.Controls 1.3 as QQC + +PlasmaComponents.ToolButton { + id: keyboardButton + + property int currentIndex: -1 + + text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Keyboard Layout: %1", instantiator.objectAt(currentIndex).shortName) + implicitWidth: minimumWidth + + visible: menu.items.length > 1 + + Component.onCompleted: currentIndex = Qt.binding(function() {return keyboard.currentLayout}); + + menu: QQC.Menu { + id: keyboardMenu + style: BreezeMenuStyle {} + Instantiator { + id: instantiator + model: keyboard.layouts + onObjectAdded: keyboardMenu.insertItem(index, object) + onObjectRemoved: keyboardMenu.removeItem( object ) + delegate: QQC.MenuItem { + text: modelData.longName + property string shortName: modelData.shortName + onTriggered: { + keyboard.currentLayout = model.index + } + } + } + } +} |