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

QObject property ids are not strictly monotonic in some Qt3DCore classes

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P1: Critical
    • None
    • 6.3.2, 6.4.0
    • Qt3D
    • None
    • macOS

    Description

      Squish does some validation on properties when wrapping QObjects for access in test scripts. Typically, QObject property ids appear to be strictly monotonic, growing from QObject with every subclass's properties getting a unique id in the inheritance chain.

      That doesn't seem to hold true for QtQuick classes derived from Qt3DCore::QEntity. Iterating the parent metaObjects and printing their propertyOffset and propertyCount - 1 (to get index ranges), I get this:

      scene3d[12912]: Qt3DRender::QCamera: 3-23
      scene3d[12912]: Qt3DCore::QEntity: 3-5
      scene3d[12912]: Qt3DCore::QNode: 1-3
      scene3d[12912]: QObject: 0-0
      
      scene3d[12912]: Qt3DCore::Quick::Quick3DEntity: 5-10
      scene3d[12912]: Qt3DCore::Quick::Quick3DNode: 3-7
      scene3d[12912]: Qt3DCore::QEntity: 3-5
      scene3d[12912]: Qt3DCore::QNode: 1-3
      scene3d[12912]: QObject: 0-0
      

      The Quick types are (afaik) registered as QML class extensions. They do not, in C++, inherit from QEntity but from QObject. QCamera however does inherit from QEntity so that doesn't seem to be the direct cause.

      This function generated above output:

      void printPropRanges( const QMetaObject *meta )
      {
          Log::info( "%s: %i-%i",
                     meta->className(),
                     meta->propertyOffset(),
                     meta->propertyOffset() + meta->propertyCount() - 1 );
      
          if ( meta->superClass() ) {
              printPropRanges( meta->superClass() );
          }
      }
      

      We worked around this in Squish by wrapping all known entity and component classes explicitly on startup instead of lazily, which is a bit ugly.

      Attachments

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

        Activity

          People

            seanharmer Sean Harmer
            makummer Marcel Kummer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes