I attempted to google this, but I kept getting hits for the wrong thing.

I have a C++ QObject class ("ApplicationDatabase") exposed to QML via
qmlRegisterSingletonInstance("com.company", 1, 0, "ApplicationDatabase", 
&m_applicationDatabase);

I have a app.js (.pragma library) that is included in many QML components 
(X.qml) I want the to use the slots/Q_INVOKABLE functions in the app.js:

i.e.
function userRoles(user) {
   return ApplicationDatabase.userRoles(user);
}

However when trying to run this, I get:
qrc:/app.js:165: ReferenceError: ApplicationDatabase is not defined


How do I make the .js file aware of the singleton?

_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to