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

qmltc fails to produce the required includes for types that only appear as the argument of a list type

    XMLWordPrintable

Details

    • Task
    • Resolution: Fixed
    • P2: Important
    • 6.8.0 FF
    • None
    • QML: Tooling
    • None
    • ea18f9f8e (dev)

    Description

      When `qmltc` compiles a QML type that has a list property, it produces a series of methods and possibly assignment that make use of the type of the list.

       

      For the generated code to be complete, the type that a list holds need to be accessible in C++.

      Generally, `qmltc` will explore the types that are referenced by the scope of the compiled type and produce an include for the correct header, in the generated code, so that the type is available.

       

      Given a type that is only referenced as the argument to a list type, for example:

      import QtQuick
      
      Item {     
          property list<Rectangle> foo : [] 
      }
      

       

      `qmltc` will fail to produce the correct header inclusion for the C++ counterpart of `Rectangle`, thus producing non-compilable code for the generated files.

       

      The correct inclusions are generated when the type appears in other contexts.

      For example, if we switched `Rectangle` and `Item`:

       

      import QtQuick
      
      Rectangle {     
          property list<Item> foo : [] 
      }
      

       

      The C++ counterpart of `Item` would be included as it can be found through `Rectangle`.

       

      Similarly, if the a reference to the type appeared in a different context, for example to instantiate an member of the list, as follows:

       

      
      import QtQuick
      
      Item {
          property list<Rectangle> foo : [Rectangle{}]
      }
      

       

      Then the correct inclusion would be generated as the type would be found as part of the search that `qmltc` performs.

       
      Hence, `qmltc` search for includes should be modified to take into consideration the inner types of list properties that appear in the original file to avoid producing code that cannot be compiled.

      Attachments

        Issue Links

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

          Activity

            People

              diseraluca Luca Di Sera
              diseraluca Luca Di Sera
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes