On 10 March 2014 04:59, Steve Gold <steveg2...@gmail.com> wrote:

>   1. Can a QML singleton contain signals and functions that are accessed
> by other QML types or just properties?
>
>

no. However, you may declare enum type by making C++ QML component.

[#QTBUG-14861] Allow enum types to be defined from QML side - Qt Bug
Tracker<https://bugreports.qt-project.org/browse/QTBUG-14861>

I usually create a Javascript file for serving static properties and
functions.


> 2. I specified
>        pragma singleton
> as the first line in MySingleton.qml and have
>      property string myText: “”
> in MySingleton.qml, specified
>      import “.”
> at the top of main.qml, and added qml in their common directory with
>      singleton MySingleton MySingleton.qml
>
> When I have
>      property string mySingletonText: MySingleton.myText
> in main.qml I get the error
>        qrc:/qml/main.qml:11: ReferenceError: MySingleton is not defined
> but MySingleton.qml is specified in my .pro and .qrc files.
>
> When I have
>      MySingleton{
>        id: singleton
>      }
> in main.qml I get the error
>      qrc:/qml/MySingleton.qml:1:1: pragma Singleton used with a non
> composite singleton type MySingleton
> I tried this because I assumed (perhaps mistakenly) that this would be the
> way to access signals and functions of a singleton.
>
> Any help would be appreciated.
>
> Thanks.
>
> Steve
>
> BTW, is a different group more appropriate. In addition, should I post
> this in the forums or use a group email?
>
>
> _______________________________________________
> Development mailing list
> Development@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development
>
>
_______________________________________________
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to