[Development] QAction-like API for QML

Stephen Kelly stephen.kelly at kdab.com
Tue Dec 18 13:22:40 CET 2012


On Monday, December 17, 2012 01:11:55 Bache-Wiig Jens wrote:
> >> How about having ToolBar.addAction() for convenience? It is exactly what
> >> we do for widgets.> 
> > Widgets is a toolkit for an imperative language. Looping over lists
> > and adding things individually is acceptable there. In a declarative
> > language it is really not the right way to go. Even if you don't want
> > to implement menus with ActionGroup, I'd still recommend that you have
> > something like it (which can take a list of Action/QAction) so that
> > you only need to list all the actions once, where-ever that may be,
> > and then add them to other places en masse.
> 
> Agreed. But we can provide convenience even if we treat tool bars as a
> visual item. For instance, you would have to do this to follow the model
> approach of actions:
> 
> RowLayout { Repeater { model: myActions ; ToolButton { action: modelData} }
> }}
> 
> Granted, a bit too verbose. However with a little bit of convenience, we can
> for instance reduce this to just:  ActionRowLayout { model: myActions }

This looks about right to me.

Thanks,

-- 
Stephen Kelly <stephen.kelly at kdab.com> | Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
www.kdab.com || Germany +49-30-521325470 || Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-Independent Software Solutions
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20121218/cdf82e8b/attachment.sig>


More information about the Development mailing list