KAction/KActionCollection proposed changes
Andreas Hartmetz
ahartmetz at gmail.com
Sun Oct 28 15:38:41 GMT 2007
Am Sonntag, 28. Oktober 2007 11:01:31 schrieb Kevin Ottens:
> Le dimanche 28 octobre 2007, Andreas Hartmetz a écrit :
> > > 3) Change KActionCollection to return a KAction* rather than a QAction*
> > > for newly created actions.
> > >
> > > This is important because calling QAction::setShortcut(s) does not set
> > > the default shortcut in KAction, as the methods are non-virtual. So,
> > > most apps will have misbehaving shortcut config dialogs otherwise. In
> > > the porting required for this I have caught many, many bugs.
> >
> > Interesting.
>
> I know we discussed this on IRC, I'm just posting this here for reference.
>
> I'm fine with such a reintroduction of KAction* in KActionCollection API if
> it is only for *factory methods*. Otherwise we'd have troubles to plug
> QActions provided by Qt into KActionCollection, that's why we did this huge
> porting away from KAction* in KActionCollection API in the first place.
>
There is an alternative: catch QEvent::ActionChanged events (probably in an
event filter on the Q/KApplication) and if it's a KAction do whatever needs
to be done to make a KAction behave like one. Simon indicated that this
should work some time ago.
It's ugly as hell so I didn't even mention it before because I'd like to avoid
it. But hey, if we need it...
More information about the kde-core-devel
mailing list