KAction and KShortcut in frameworks

David Faure faure at kde.org
Fri May 11 18:42:09 UTC 2012


On Friday 11 May 2012 19:57:11 Mark wrote:
> >  KShortcutManager::setDefaultShortcut(newAct, Qt::Key_F6);
> 
> I like this idea! 

Good, me too :-)

> I was actually intending to use the Shortcut Editor but i
> didn't look into specifics yet.
> 
> With dynamic property you're talking about
> http://qt-project.org/doc/qt-4.8/qobject.html#setProperty right?

Yes. Just like the current KAction code already does, to store the default 
primary and alternate shortcuts.

> > krazy would basically flag any direct call to QAction::setShortcut as a
> > "bad
> > hardcoded shortcut, you should use KShortcutManager instead".
> 
> What you're suggestion is that _all_ KAction obects go through
> KShortcutManager. 

All those with a default shortcut set by the application, yes, obviously.

> Might be good for an ideal world situation but i don't
> really know if this is desirable. I just don't know for this part.

Why not? How else would this work? I'm not sure what the reservation is, here.

The alternative is hardcoding shortcuts that the user cannot modify, I don't 
see why we would want to do that.

> I do want to get back on KInputShortcut and KInputSequence about them being
> not KDE specific and should end up in Qt. I fully agree and there has been
> discussion about that some time ago on the Qt mailing lists. I actually
> started that discussion so i know what i'm talking about :) 

Ah, great. Sorry for my bad memory ;)

> The idea back
> then was that global shortcuts should use the platform plugin stuff and
> should use some kind of global shortcut storage mechanism. The thing that's
> called "Shortcut Editor" in KDE. Mac and Windows sadly don't have such
> applications. So the Qt implementation would be quite... difficult. KDE
> already has some more infrastructure with global shortcuts so there it's
> "fairly easy" to get the suggested approach working.

I'm not talking about global shortcuts, but about input shortcuts (i.e. 
including gestures and mouse+keyboard combinations in there).
Isn't that the idea of KInputShortcut?

I'm leaving global shortcuts completely on the side, they are a whole other 
can of worms. One step at a time :-)

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Sponsored by Nokia to work on KDE, incl. KDE Frameworks 5



More information about the Kde-frameworks-devel mailing list