[Interest] Standard QKeySequence for "Fullscreen"
Stephen Kelly
steveire at gmail.com
Sat Apr 21 16:12:30 CEST 2012
Till Oliver Knoll wrote:
>
> 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
>>> settings,
>>
>> 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:
>
> http://api.kde.org/4.0-api/kdelibs-
apidocs/kdeui/html/namespaceKStandardAction.html
>
> 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
You would also have to deal with changing a shortcut for all running
applications (notifying them that it has changed etc), not just at startup.
> 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...
KDECore depends on QtCore and QtDBus (on Unix, though this creates some
problems). As QApplication is in QtGui in Qt4, it's not bogus for that
reason alone.
It is bogus in the Qt 5 context though, because KDECore won't exist anymore.
Global shortcuts is the biggest problem we still have to find a solution
for, so if you contribute something to Qt 5 for that, it would be helpful.
It might even makes sense to create a QPA abstraction for it. QAction is
'done' in Qt 5, so hopefully we'll see some new abstraction for actions at
some point in Qt 5.x anyway.
Thanks,
Steve.
More information about the Interest
mailing list