QActions in QML
Sebastian Kügler
sebas at kde.org
Tue Oct 30 12:20:22 UTC 2012
On Monday, October 29, 2012 13:46:18 Marco Martin wrote:
> On Monday 29 October 2012, Daker Fernandes Pinheiro wrote:
> > > > Daker Fernandes Pinheiro
> > > > http://codecereal.blogspot.com
> > > isn't QAction already registered as "action" primitive type?
> >
> > At least not on QtQuick 1.1
>
> not sure if is really qaction or some wrapper class, but
> http://qt-project.org/doc/qt-4.8/qml-action.html
I don't know either. Using QAction as QtObject in QML works. On the other
hand, QAction doesn't have trigger() as Q_INVOKABLE, yet it is one for the
runtime (one can just call trigger() on a QAction passed into the runtime.
I played around with passing lists of QActions into the runtime, there's one
way it works, namely using QDeclarativeListProperty<QAction> to pass the list
to the runtime. I've already changed (and cleaned up my code) to do this, and
it seems to work well. (No real type knowledge though, as just everything from
the QAction is mapped into the runtime -- not really convenient, since QAction
has "text" and "icon" properties, which make it easy to clash with properties
you might already have in your delegate.
--
sebas
http://www.kde.org | http://vizZzion.org | GPG Key ID: 9119 0EF9
More information about the Plasma-devel
mailing list