Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.3.0
-
None
-
40a6845bcce22aca96e1dee26360bdff3e9520fb (qtdeclarative)
Description
When registering a pointer type with qRegisterMetaType<ExampleModel*>, exposing the pointer to qml as context property and trying to use it in
Q_PROPERTY(ExampleModel *model READ model WRITE setModel NOTIFY modelChanged)
leads to an error "Unable to assign ExampleModel to ExampleModel*" and the QML is not shown.
The above scenario works in Qt 5.1.1 (with QtQuick2ApplicationViewer), it doesn't work in Qt 5.3 with QtQuick2ApplicationViewer, and it works in Qt 5.3 with QQmlApplicationEngine, but it still prints the "Unable to assign .." error message. Thus this causes greatest trouble to QtQuick2ApplicationViewer users who try to upgrade to Qt 5.3.
The attached SupportExamples.tar.gz contains two projects to reproduce the error: one for QtQuick2ApplicationViewer and another for QQmlApplicationEngine.
There exists a workaround though: using qmlRegisterType<ExampleModel> instead of qRegisterMetaType<ExampleModel*> seems to do the trick.