Hi, ...I don't even know how to phrase the subject of this mail...
I'm hacking on SMPC and I want to reorganize the spaghettis of the code and I'm stuck at a problem now, where I don't even know what to search for: I created a c++ class called AlbumList, and i registered it in qml, ... ==== qmlRegisterType<AlbumList>("smpc", 1, 0, "AlbumList"); ==== ...so it can be instanciated there like this: ==== ListModel { model: AlbumList { } } ==== This works fine. Now that the object is instantiated it needs to fetch information from mpd about the albums and get the coverimages from a database. Both are instantiated in the "controller". ==== Controller::Controller(....) { mImgDB = new ImageDatabase(); mNetAccess = new NetworkAccess(); } ==== The controller gets created in main.cpp: ==== Controller *control = new Controller(view,0); ==== How can AlbumList access mImgDB and mNetAccess? One solution could be to register the controller itself in qml and then write sth like this in qml: ==== AlbumList { imgDB: controller.imgDB netAccess: controller.netAccess } ==== but it's redundant. Isn't there a way I can solve this inside c++? Do I have to register AlbumList differently in qml? Can I influence, which constructor of AlbumModel is used by qml, so I can hand over netAccess and imgDB as parameters. I hope I could make myself clear about this. Greetings, fooxl. _______________________________________________ SailfishOS.org Devel mailing list To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org