Priority: Not Evaluated
Resolution: Out of scope
Affects Version/s: Qt Creator 2.3.1
Fix Version/s: None
Component/s: Remote Linux
OS X/Lion / QtSDK 1.1.3
Exposing a C++ QObject to the QML side using Harmattan/QmlApplicationViewer::setContextProperty fails to expose the object when using boostable project.
Steps to reproduce and for the workaround
- Create a new Qt Quick project using the latest QtSDK
- Make sure to select Harmattan target and boostable options
- Expose any QObject based object to the QML side using the following way:
Q_DECL_EXPORT int main(int argc, char *argv)
QScopedPointer<QApplication> app(createApplication(argc, argv));
- Try to use your exposed object in a QML e.g.
- This will display a reference error in a console.
- A workaround for the problem is to add a public method to QmlApplicationViewer, which returns root context from a private view object e.g.
QDeclarativeContext * foo() const
The problem is that the addition is done to the generated code, which can be overwritten almost at any time so the fix should be done when generating the code by Qt Creator.