[Development] QAction-like API for QML

Stephen Kelly stephen.kelly at kdab.com
Wed Dec 12 18:35:18 CET 2012


On Wednesday, December 12, 2012 09:44:10 André Somers wrote:
> 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.

Yes. I agree. The state-management parts of kontact actions is hundereds of 
lines of (shared) code.

> 
> The decoration around it - the user visible strings, icons and whatnot -
> is indeed UI logic. 

Yes. That stuff is also not UI-specific - not tied to either QML or widgets.

> 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.
> 

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/20121212/12bb2fa2/attachment.sig>


More information about the Development mailing list