[Development] QAction-like API for QML

André Somers andre at familiesomers.nl
Wed Dec 12 09:44:10 CET 2012

Op 11-12-2012 21:59, Alan Alpert schreef:
> On Tue, Dec 11, 2012 at 10:49 AM, Shawn Rutledge
> <shawn.rutledge at digia.com> wrote:
>> On Tue, Dec 11, 2012 at 09:48:22AM -0800, Alan Alpert wrote:
>>> Why can't this be QML-only? For the set of controls exposed in
>>> C++-only we have a C++-only Action API. When we add a set of controls
>>> exposed in QML-only we can have a QML-only Action API. We don't
>> Because it seems likely that the business logic of an application would
>> be written in C++, so why not export the actions that the logic can
>> support at the same time?
> The way I see it, the actions are UI logic, not business logic, and
> belong on the QML side of the divide (although they are right on the
> edge).
I disagree here. The core of the action - the abstraction of the action 
method itself and its availability in the current state - is business 
logic IMO. The same goes for any value the action may have: checked, or 
perhaps some other value. The action logically bundles state (the 
availability of an action) with the action itself.

The decoration around it - the user visible strings, icons and whatnot - 
is indeed UI logic. That's why I think that perhaps we conceptually need 
something like a CoreAction and a UiAction. The UiAction would 
'decorate' a CoreAction with the stuff that is needed to represent it in 
a UI. The implementation of the UiAction part would be different for QML 
and Widgets, I think.

Actions are a very powerful piece of glue between business and UI logic 
if used this way.


More information about the Development mailing list