Re: [Interest] SingletonType functions not visible in QML

2015-05-23 Thread mark diener
How would somebody "install" the singleton to work in qmlscene (quick 2)? Or someway to simulate the singleton functions in QML? This way the QML preview functionality would be available Here is the QML Scene Output: ### Starting external tool "/macdev/qt541/5.4/clang_64/bin/qmlscene" /mac

Re: [Interest] SingletonType functions not visible in QML

2015-05-22 Thread Dmitry Volosnykh
Example is fine. On Fri, May 22, 2015 at 6:00 PM, rpzrpz...@gmail.com wrote: > Hello: > > So do we need a static Sing* in the singleton provider or is the example > in the documentation correct? > > I would guess the provider is called ONCE by the QML engine and not > multiple times, but I am us

Re: [Interest] SingletonType functions not visible in QML

2015-05-22 Thread rpzrpz...@gmail.com
Hello: So do we need a static Sing* in the singleton provider or is the example in the documentation correct? I would guess the provider is called ONCE by the QML engine and not multiple times, but I am usually mistaken. But I guess the static allocation will remove all doubt? Ben Lau -> Than

Re: [Interest] SingletonType functions not visible in QML

2015-05-22 Thread Samuel Stirtzel
2015-05-22 16:30 GMT+02:00 Dmitry Volosnykh : > 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,

Re: [Interest] SingletonType functions not visible in QML

2015-05-22 Thread Dmitry Volosnykh
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 implem

Re: [Interest] SingletonType functions not visible in QML

2015-05-22 Thread Samuel Stirtzel
2015-05-22 16:27 GMT+02:00 Samuel Stirtzel : > 2015-05-22 15:56 GMT+02:00 mark diener : > >> static QObject *singprovider(QQmlEngine *gengine, QJSEngine *gscriptEngine) >> { >> Q_UNUSED(gengine) >> Q_UNUSED(gscriptEngine) >> Sing* gsing = new Sing(); >> return gsing; >> } > > Is the

Re: [Interest] SingletonType functions not visible in QML

2015-05-22 Thread Samuel Stirtzel
2015-05-22 15:56 GMT+02:00 mark diener : > 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

Re: [Interest] SingletonType functions not visible in QML

2015-05-22 Thread Dmitry Volosnykh
Also try naming your functions with first letter lowercased. On Fri, May 22, 2015 at 5:06 PM, Ben Lau wrote: > > > On 22 May 2015 at 21:56, mark diener wrote: > >> Hello: >> >> I have a test qmlRegisterSingletonType project as listed below. >> >> The singleton Q_INVOKABLE functions are somehow

Re: [Interest] SingletonType functions not visible in QML

2015-05-22 Thread Ben Lau
On 22 May 2015 at 21:56, mark diener wrote: > Hello: > > I have a test qmlRegisterSingletonType project as listed below. > > The singleton Q_INVOKABLE functions are somehow not visible or in > "scope". > > Anybody have ideas about this? > > # sing.h > > #include > > #include > > #include >

[Interest] SingletonType functions not visible in QML

2015-05-22 Thread mark diener
Hello: I have a test qmlRegisterSingletonType project as listed below. The singleton Q_INVOKABLE functions are somehow not visible or in "scope". Anybody have ideas about this? # sing.h #include #include #include #include class Sing : public QObject { Q_OBJECT public: