Details
-
Bug
-
Resolution: Done
-
Not Evaluated
-
Qt Creator 2.3.1
-
None
-
b41237f01ef626381d8519f0703e54a4551f6c36
Description
Most Qt Quick Apps need to register a C++ item into the QML context. According to the documentation, this is done with qmlRegisterType in main.cpp before loading the qml file.
However, the latest Qt Quick Application template is designed in a way so that the declarative root context isn't accessible from main.cpp anymore. Extending the qmlapplicationviewer.cpp/.h is necessary, which developers are not supposed to do.
More detailed description:
http://meegoharmattandev.blogspot.com/2011/11/qmlapplicationviewer-and.html
The fix proposed in the blog post is to add new methods to the template:
qmlapplicationviewer/qmlapplicationviewer.h:
public:
QDeclarativeContext *rootContext();
qmlapplicationviewer/qmlapplicationviewer.cpp:
QDeclarativeContext *QmlApplicationViewer::rootContext()
{
return d->view->rootContext();
}
Attachments
Issue Links
- depends on
-
QTCREATORBUG-6473 Harmattan application template creates two QDeclarativeView instances which causes problems
- Closed