Calling static function from QML? Doable?
-
wrote on 4 Oct 2011, 21:41 last edited by
Thanks guys, I guess I'll try to enter in issue that static functions should be directly callable from QML, as not having this feature is making certain patterns difficult if not impossible (the mentioned problem with enum coming from a different class ...).
-
wrote on 4 Oct 2011, 21:50 last edited by
Sounds like a good idea.
As an aside, as a workaround, you could -- and yes, I know it's dirty and nasty -- always mirror the enum in the class that's visible to QML.
-
wrote on 5 Oct 2011, 00:10 last edited by
Thanks for the tip. It might do it for at least some of the usecases.
-
wrote on 5 Oct 2011, 15:41 last edited by
If you do add a jira request for the issue, please be sure and add a link to it here for future reference.
-
wrote on 5 Oct 2011, 23:36 last edited by
Hi,
For QtQuick 2.0 we are introducing an additional "module API", which should allow you to implement the singleton pattern more easily.
The docs for this don't seem to be correctly generated at the moment, but you can view them in source at https://qt.gitorious.org/qt/qtdeclarative/blobs/master/src/declarative/qml/qdeclarative.h (look for qmlRegisterModuleApi)
Regards,
Michael -
wrote on 6 Oct 2011, 12:29 last edited by
[quote author="mbrasser" date="1317857789"]Hi, For QtQuick 2.0 we are introducing an additional "module API", which should allow you to implement the singleton pattern more easily.[/quote]
Do you coincidentally know if there is a (provisional) changelog for QtQuick 2.0, a compiled list of (planned) changes or something like that?
-
[quote author="Lukas Geyer" date="1317904148"][quote author="mbrasser" date="1317857789"]Hi, For QtQuick 2.0 we are introducing an additional "module API", which should allow you to implement the singleton pattern more easily.[/quote]
Do you coincidentally know if there is a (provisional) changelog for QtQuick 2.0, a compiled list of (planned) changes or something like that?[/quote]
Not a real changelog, but at least a glimpse on what's to come: http://doc.qt.nokia.com/qt5-snapshot/qtquick2-whatsnew.html
-
wrote on 7 Oct 2011, 09:11 last edited by
Thanks.
-
wrote on 13 Nov 2011, 10:23 last edited by
Hi,
you can use approach described "here":http://doc.qt.nokia.com/4.7-snapshot/qtbinding.html#embedding-c-objects-into-qml-components. It works fine for me. -
wrote on 25 Jun 2013, 23:01 last edited by
[quote author="mbrasser" date="1317857789"]Hi,
For QtQuick 2.0 we are introducing an additional "module API", which should allow you to implement the singleton pattern more easily.
[/quote]
So, is the new module api the function qmlRegisterSingletonType?