[Interest] SingletonType functions not visible in QML

Samuel Stirtzel s.stirtzel at googlemail.com
Fri May 22 16:28:54 CEST 2015


2015-05-22 16:27 GMT+02:00 Samuel Stirtzel <s.stirtzel at googlemail.com>:
> 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();
>
damn Ctrl+Enter to send a mail...

 static QObject *singprovider(QQmlEngine *gengine, QJSEngine *gscriptEngine)
 {
     Q_UNUSED(gengine)
     Q_UNUSED(gscriptEngine)
     static Sing* gsing = new Sing();
     return gsing;
 }


-- 
Regards
Samuel



More information about the Interest mailing list