[Interest] Standard QKeySequence for "Fullscreen"
Till Oliver Knoll
till.oliver.knoll at gmail.com
Sat Apr 21 14:53:13 CEST 2012
Am 21.04.2012 um 13:04 schrieb Till Oliver Knoll <till.oliver.knoll at gmail.com>:
>> I assume KDE does not provide a way for applications to query those
> Without any concrete knowledge of the KDE API: I can't imagine that there's /no/ such public API which would expose *global* application settings.
Maybe there is really no (public) API to just get the QKeySequence, as defined in the KDE settings dialog, because to my understanding KDE applications just need to bother about the proper KAction instance, which for standard actions is easily instantiated via:
And I guess the corresponding shortcut is properly set according to the user settings respective the HIG recommendations.
As a proof of concept, a naive "user settings aware" Qt implementation could be
- When initialising QApplication and
- When we detect running on KDE
- Dynamically link to "KDE Core" library (if not already done so anyway)
- For each standard QKeySequence:
* Instantiate the corresponding KAction via KStandardAction
* Get the shortcut (QKeySequence) set for the KAction and initialise the standard QKeySequence in Qt with it
Off course instantiating n objects just for getting a shortcut is totally nonsense, let alone that linking against a library (KDE Core) which on its turn depends on Qt itself is not such a brilliant idea...
Heck, but via clever plugin mechanisms Qt also manages to call the standard KDE file dialog today, so I'm pretty sure there is a way to query the KDE shortcut settings, too, in some way :)
More information about the Interest