> > Step 1: mySharedPtr.data() ==> MyShared* P; >> Step 2: make sure the QML engine doesn't assume ownership: >> QDeclarativeEngine::**setObjectOwnership >> Step 3: hand over P to QML: setProperty or setContextProperty >> > > Yep, those steps seem to be the current requirement. If my patches get in > (not guaranteed), it will be reduced to just: > > Step 1: setContextProperty("myname", mySharedPtr); > > or > > Step 1: setContextProperty("myname", mySharedPtr.toWeakRef()); > > depending on your needs. > > > >> When I said the database layer should preferably remain QML agnostic, >> I merely wanted to keep "patchup code" like "setObjectOwnership" out >> of a clean set of data classes for purist reasons. (Really it is an >> exaggeration imho.. I have no problem using stuff from QtDeclarative >> in code. Will need it for QList properties anyway. It's just a design >> reflex). >> > > Yes, I agree. > > > Leaving out step 2 is bad, right? >> > > Yes, and worse it might not obvious to consumers of the API that it's > needed. >
Hi again. I have modified the wiki page that Sivan started (my name in qt-project.orgis "Centipede"). In my view your advice above is serious enough to warrant a user comment in the footnote section of at least the documentation pages of 4.8. But I cannot for the life of me figure out where to add such comments. Is qt-project.org's user comment system up and running? Best regards, Rene Jensen
_______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development