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

Qt meta-object system and inheritance of Q_GADGET classes

    XMLWordPrintable

Details

    • Windows
    • 1029b2b9f3d0ff88c0900fbfec2fac873aa6bcd4

    Description

      Q_GADGET.ZIP

      When Q_GADGET class inherits other Q_GADGET class, some Q_INVOKABLE methods in derived class are inaccessible in QML code. Attached program produces the following output:

      qml: item.prop1: 1
      qml: item.prop2: 2
      qml: item.prop3: 3
      qml: item.prop4: 4
      qml: item.prop5: 5
      qml: item.method1: function() { [native code] }
      qml: item.method2: function() { [native code] }
      qml: item.method3: function() { [native code] }
      qml: item.method4: undefined
      qml: item.method5: function() { [native code] }

      If line (1) in Items.h is uncommented, method4 becomes accessible:

      qml: item.prop1: 1
      qml: item.prop2: 2
      qml: item.prop3: 3
      qml: item.prop4: 4
      qml: item.prop5: 5
      qml: item.method1: function() { [native code] }
      qml: item.method2: function() { [native code] }
      qml: item.method3: function() { [native code] }
      qml: item.method4: function() { [native code] }
      qml: item.method5: function() { [native code] }

      Results may vary, depending on how many methods are in the base class.

      Qt 5.14.1 is not the first version with this bug. It was at least in Qt 5.9.x and later.

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            s.m. s. m.
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes