[Interest] SingletonType functions not visible in QML
Dmitry Volosnykh
dmitry.volosnykh at gmail.com
Fri May 22 16:30:32 CEST 2015
Samuel, what you ask is explained here:
http://doc.qt.io/qt-5/qqmlengine.html#qmlRegisterSingletonType-2
citation:
NOTE: A QObject singleton type instance returned from a singleton type
provider is owned by the QML engine. For this reason, the singleton type
provider function should not be implemented as a singleton factory.
On Fri, May 22, 2015 at 5:27 PM, Samuel Stirtzel <s.stirtzel at googlemail.com>
wrote:
> 2015-05-22 15:56 GMT+02:00 mark diener <rpzrpzrpz at gmail.com>:
>
> > static QObject *singprovider(QQmlEngine *gengine, QJSEngine
> *gscriptEngine)
> > {
> > Q_UNUSED(gengine)
> > Q_UNUSED(gscriptEngine)
> > Sing* gsing = new Sing();
> > return gsing;
> > }
>
> Is the return value of the function cached in qt internally?
> Or will this just create a new "singleton" with every call?
>
> how about this:
>
> static Sing* gsing = new Sing();
>
>
> --
> Regards
> Samuel
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150522/17a1bd13/attachment.html>
More information about the Interest
mailing list