QML/C++ interaction

Dirk Hohndel dirk at hohndel.org
Sat Feb 6 10:51:23 PST 2016


On Sat, Feb 06, 2016 at 08:03:45PM +0200, Willem Ferguson wrote:
> Dirk,
> I am looking at the implementation, from the QML side, of the class named
> "downloadManager" at the moment. In the Subsurface-mobile, the QML drives
> the whole process and the coordination and linkages, consequently, has to be
> from the QML side. One of the critical thing Tomaz has pointed out is the
> need for setting the context of C++ items used by QML.
> 
> 1) From what I can see, the root context is set in
> subsurface-mobile-helper.cpp. Since it looks like the context definitions
> must be finalised before the QML engine is launched, is it that
> subsurface-mobile-helper.cpp is the appropriate place to set the context
> definitions? I see some context definitions in filebrowser.cpp in
> Plasma-Mobile which would contradict the above statement.

I have not the slightest clue. This is all black magic as far as I'm
concerned and it almost never works the way I think it should work.

The way I deal with this is that I mimic things that work. That's how most
of my Qt and QML programming has been done.

> 2) This brings up the question of where the most appropriate place is to
> launch "downloadManager". Since downloadManager should ideally only be
> loaded when downloads are actually done, I cannot see that
> subsurface-mobile-helper.cpp (where the QML engine is launched) is very
> appropriate. I would say that the closest place is QMLManager.

You can instantiate the class in subsurface-mobile-helper.cpp - that
should be cheap to do. What exactly do you mean by "launched"?

/D


More information about the subsurface mailing list