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

qmlRegisterType Family doesn't deal well with templated types

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.13.0
    • Core: Object Model
    • None

    Description

      Hello,

      We're using [Verdigris|https://github.com/woboq/verdigris] to register our own schema-derived types with Qml. Some of these are templated, and their meta-object name carries a template-parameter, like this: 

      TupleProxy<Ts...>

      When registering these with qmlRegisterType/qmlRegisterUncreatableType, it also tries to register the ListProperty Type:

      QQmlListProperty<TupleProxy<Ts...>>

      Unfortunately, QMetaObject::normalizedType() deals with the double ">>" in the manner that was required pre-C++11, and inserts a space, resulting in

      QQmlListProperty<TupleProxy<Ts...> >
      

      Which leads to the registration erroring out.

      I see two options to fix this:

      1) Modify the QML_GETTYPENAMES macro to check for a trailing '>', and insert the extra space in listName

      or

      2) Modify the behaviour of normalizedType() to not insert the extra space. This might break compatibility or lead to other unexpected issues.

       

      Please let me know what you think about this issue. I can provide a patch for approach 1)

      Regards,
      Jonathan

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            strfry Jonathan Sieber
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes