Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QMetaProperty::read: Unable to handle unregistered datatype 'TreeItem<InspectorItem>*'
Qt 6.11 is out! See what's new in the release blog

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

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    KrabQT
    wrote on last edited by
    #1

    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)@

    1 Reply Last reply
    0
    • K Offline
      K Offline
      KrabQT
      wrote on last edited by
      #2

      At least any tips please?

      1 Reply Last reply
      0
      • T Offline
        T Offline
        t3685
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0
        • K Offline
          K Offline
          KrabQT
          wrote on last edited by
          #4

          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]

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved