[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Communication between C++ and QML
From:       Stephen Kelly <steveire () gmail ! com>
Date:       2011-06-03 21:26:45
Message-ID: isbjir$qii$1 () dough ! gmane ! org
[Download RAW message or body]

Stefan Majewsky wrote:

> Hi,
> 
> I've been looking into QML again for kdegames. Some background: I
> added a QDeclarativeImageProvider to feed images from libtagaro's
> ThemeProvider into QML, and that mostly works (with an emphasis on
> mostly; QTBUG-14900). Then I tried something more difficult: I wanted
> to port a game from QML, and chose KNetwalk because it has its
> algorithms split in an AbstractGrid class, which is subclassed for the
> QGraphicsView representation.
> 
> Now as far as I understand the (IMHO surprisingly sparse)
> QtDeclarative module documentation, the main gateway for transferring
> information between C++ and QML is
> declarativeView->engine()->rootContext()->setContextObject(). QML
> retrieves data from the properties of this object and the subobjects
> which it references, and invokes via JavaScript functions in this
> object to propagate user input to the C++ layer.

setContextProperty(), but in general, yes I think that's the idea. It does 
require/enforce some design constraints as you note though.
 
> 
> Is this correct? If so, I get a feeling that it would require a
> potentially epic amount of boilerplate to make my already
> interface-agnostic data available to QML. Can I do anything to make
> this task simpler?

I can clone kdegames and have a look. What kind of boilerplate do you think 
you'll need?



 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic