Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-85625

REG: "QMetaProperty::read: Unable to handle unregistered datatype"

    XMLWordPrintable

Details

    Description

      slate-old-type-reg.zip uses qmlRegisterType and friends to register types:

      void Application::registerQmlTypes()
      {
          qmlRegisterType<CanvasPaneItem>("App", 1, 0, "CanvasPaneItem");
          qmlRegisterType<ImageCanvas>();
          qmlRegisterType<ImageCanvas>("App", 1, 0, "ImageCanvas");
          qmlRegisterUncreatableType<CanvasPane>("App", 1, 0, "CanvasPane", "Can't create instances of CanvasPane");
      
          qRegisterMetaType<CanvasPane*>();
          qRegisterMetaType<CanvasPaneItem*>();
          qRegisterMetaType<ImageCanvas*>();
      }
      
      import QtQuick 2.13
      import QtQuick.Controls 2.13
      
      import App 1.0
      
      ApplicationWindow {
          id: window
          width: 1200
          height: 800
      
          CanvasPaneItem {
              id: paneItem
              pane: canvas.paneAt(0)
      //        pane: theCanvas.paneAt(0)
              anchors.fill: parent
          }
      }
      

      It fails with:

      QMetaProperty::read: Unable to handle unregistered datatype 'ImageCanvas*' for property 'CanvasPaneItem::canvas'
      qrc:/qml/main.qml:32: TypeError: Cannot call method 'paneAt' of undefined
      

      You can also uncomment the context property code (and comment out pane: canvas.paneAt(0)) to get this error message:

      qrc:/qml/main.qml:33:9: Unable to assign CanvasPane to [unknown property type]
      

      The same result can be seen with slate-new-type-reg.zip, which uses the new type registration macros.

      It works as expected (with no errors) in 5.15.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              fabiankosmale Fabian Kosmale
              mitch_curtis Mitch Curtis
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes