proposed KAction/KActionCollection API changes

Simon Hausmann hausmann at kde.org
Wed Jan 3 21:51:12 GMT 2007


On Wednesday 03 January 2007 12:23, Kevin Ottens wrote:
> Le Mardi 2 Janvier 2007 23:16, Olivier Goffart a écrit :
> > Anyway, in general, we create a lot of KAction in the same time.
> > So i think it was a benefit to create one action in one line. I find it
> > aesthetic.
>
> Well, I think we agree to disagree here. :-)
>
> > Also, addAction sometimes create a new object, and sometimes doesn't.
> > maybe the addAction() which create a new KAction should be newAction()
>
> Actually, at the start it was named createAction(), we chose to rename it
> addAction() for consistency with the Qt API which name this kind of methods
> addFoo() when they "create+insert".

Qt uses addAction for both, for "insert" and "create+insert" for convenience.

> That said, Simon do you think we should have the following?
>
> QAction *KActionCollection::addAction(const QString &name);
> and
> KActionCollection::insertAction(const QString &name, QAction *action);
>
> (Currently both are named addAction())

I'm not sure if a separate insertAction() is worth it. Yes, insert is more 
consistent with the set/hash type of naming, but on the other hand 
addAction(const QString &name, QAction *action) fundamentally does the same 
as addAction(const QString &name). /Both/ add/insert by named index, so why 
call the one overload different than the other?


Simon

Simon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20070103/45140a56/attachment.sig>


More information about the kde-core-devel mailing list