proposed KAction/KActionCollection API changes

Thomas Zander zander at kde.org
Tue Jan 2 22:32:48 GMT 2007


On Tuesday 02 January 2007 22:30, Simon Hausmann wrote:
> KAction *a = new KAction(KIcon("reload"), i18n("&Reload"), this);
> a->setShortcut(Qt::ControlModifier + Qt::Key_F5);
> connect(a, SIGNAL(triggered()), this, SLOT(reload());
> actionCollection()->addAction("view_reload", a);

That last line looks a bit odd to me. Too many repeating of the word 'action'.
I was thinking of some alternatives;
KActionCollection:
  add(..)   // makes more sense to me; shorter but still to the point.
  insert(...) // makes it look more like a QHash api.

Hmm; does C++ allow you to have
  QAction *addAction(const QString&, QAction *);
on the same class as 
  KAction *addAction(const QString&, KAction *);
and
 KAction *addAction(const QString&); 
?
-- 
Thomas Zander
-------------- 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/20070102/8b2cae6d/attachment.sig>


More information about the kde-core-devel mailing list