proposed KAction/KActionCollection API changes
richmoore44 at gmail.com
Tue Jan 2 21:57:36 GMT 2007
On 1/2/07, Simon Hausmann <hausmann at kde.org> wrote:
> 1) KAction and its subclasses get the same 3 (compatible) constructors as
Makes sense I guess since we're basically stuck with the lack of names
in QObject constructors thoughout 4.0.
> 2) Actions need to be explicitly added to the actioncollection. The name used
> for extraction from the actioncollection (and with xmlgui) is specified when
> adding the action to the collection, for symmetry. We would like to use
> KActionCollection::addAction(const QString &name, QAction *action) for that.
I don't really like this, it seems to me the name should be property
of the QAction object itself. This API introduces a number of
- Can an object be added multiple times with different names?
- How can we provide the neat functionality we had before with
KStdActions which already new their own names? This doesn't seem
possible here at all.
> 3) KActionCollection supports QActions and also provides configurable
> shortcuts for them, through the use of dynamic properties.
I don't understand this.
> [ 4) Get rid of the ugly setObjectName() hiding in KAction ]
Don't really understand this either - is this just a name clash?
> Or alternatively:
> KAction *a = actionCollection()->addAction("view_reload");
> a->setShortcut(Qt::ControlModifier + Qt::Key_F5);
> connect(a, SIGNAL(triggered()), this, SLOT(reload());
How does this work for types derived from KAction?
More information about the kde-core-devel