[Interest] QML: Use singleton types instead of pragma library scripts

Dmitry Q linuxsquirrel.dev at gmail.com
Fri Dec 26 11:12:03 CET 2014


Hi. In the official QML documentation we see the following suggestion (
http://doc.qt.io/qt-5/qtquick-performance.html):

>>>
Use singleton types instead of pragma library scripts

If you are using a pragma library script to store application-wide instance
data, consider using a QObject singleton type instead. This should result
in better performance, and will result in less JavaScript heap memory being
used.
<<<

What does is mean? How should we use QObject singletons? For example, I
have the following ".pragma library" JS to store application-wide constants:

.pragma library
var X = 10;
... many other declarations...

How should I rewrite this with QObject singletons?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20141226/7ff78e04/attachment.html>


More information about the Interest mailing list