Cqoicebordel
Cqoicebordel

Reputation: 13

QML 2 / KDE - What is the Controls to register shortcuts

All across KDE, I can see this button to register shortcuts :
Shortcut register button

Is there a QML control/anything to be used to have that ? I found nothing in https://doc.qt.io/qt-5.15/qmltypes.html, or anywhere else.
If not, how can I provide something similar in the settings of my plasmoid ?

Upvotes: 0

Views: 86

Answers (1)

Cqoicebordel
Cqoicebordel

Reputation: 13

I posted the question after a long, long search (several days), but finally, I found the answer the same day I posted the question :/

Here you go :

import org.kde.kquickcontrols 2.0

KeySequenceItem{
    id: keySeq
    modifierlessAllowed: true
    visible: true
    multiKeyShortcutsAllowed: false
}

Label {
    text: keySeq.keySequence
}

The source is here : https://github.com/KDE/kdeclarative/blob/master/src/qmlcontrols/kquickcontrols/KeySequenceItem.qml
A bit of documentation would have been great though…

Edit : Sadly, it behaves as though it handles only global shortcuts. That's a bit of a PITA.

Upvotes: 0

Related Questions