RFC: Application wide shortcuts in QML

Mark markg85 at gmail.com
Fri Dec 7 21:39:09 UTC 2012


Hi,

I just made this blog post [1] and would like to see if i can include
this - quite handy - QML component in the KDE imports. I think it fits
quite nicely in the "qtextracomponents" import.

The syntax is as follows (in QML):
Shortcut {
    key: "Ctrl+C"
    onActivated: {
        console.log("JS: " + key + " pressed.")
    }
}

And that gives you the application wide CTRL + C shortcut. Right now
doing something like that in QML with either stock QML (Qt 4.8 and Qt
8) or the additional plasma imports you simply don't have any option
to register application wide shortcuts. This component allows that
functionality.

Shall i open a review request for this or can i just add [2] and [3]
to [4] and obviously make it available through qmlRegisterType.

Note: this functionality might come in very handy with the new
plasmoids as application type!

Cheers,
Mark

[1] http://kdeblog.mageprojects.com/2012/12/07/application-wide-shortcuts-in-qml-this-time-without-qshortcut/
[2] http://gitorious.org/porpoise/master/blobs/master/shortcut.cpp
[3] http://gitorious.org/porpoise/master/blobs/master/shortcut.h
[4] http://quickgit.kde.org/?p=kde-runtime.git&a=tree&h=2493cdee3cd112c7a702f14e6b88c7b54606bfa9&hb=c781a38b9caf2a1716bbea0c91633932f8f23a7f&f=plasma%2Fdeclarativeimports%2Fqtextracomponents


More information about the Plasma-devel mailing list