QMetaProperty::read: Unable to handle unregistered datatype 'TreeItem<InspectorItem>*'



  • Qt doesn't allow to register class template?

    My class hierarchy is:

    @TreeItemTemplateBackend : public QObject

    template<typename T>
    TreeItem : public TreeItemTemplateBackend@

    This is what i registred in qml:

    @qmlRegisterType<InspectorItem>("ge.gui", 1, 0, "InspectorItem");
    qmlRegisterType<TreeItemTemplateBackend>("ge.gui", 1, 0, "TreeItemTemplateBackend");
    qmlRegisterType<TreeItem<InspectorItem>>("ge.gui", 1, 0, "TreeItem");@

    I am still getting this error:

    QMetaProperty::read: Unable to handle unregistered datatype TreeItem<InspectorItem>* for property 'Inspector::root'

    Inspector::root is:

    @Q_PROPERTY(TreeItem<InspectorItem> * root READ root NOTIFY rootChanged)@



  • At least any tips please?



  • I might be mistaken but having template classes and the macro Q_OBJECT does work. Are you declaring it in your template class?



  • No you cannot have Q_OBJECT macro in template class. Ty for reply anyway, i am frustrated from this.

    [quote author="t3685" date="1402858620"]I might be mistaken but having template classes and the macro Q_OBJECT does work. Are you declaring it in your template class?[/quote]


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.