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

Unresolved type even it is listed

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • 6.8
    • 6.7.0
    • QML: Tooling
    • None
    • 2fc45188c (dev)

    Description

      We have a warning that we cannot fix. It seems it is a bug in qmllint.
      I added an example project for this. QmlDummy.tar.gz

      class QmlTestSubProperty : public QObject
      {
      	Q_OBJECT
      	QML_ELEMENT
      
      	Q_PROPERTY(bool valid READ isValid CONSTANT)
      	public:
      	[[nodiscard]] bool isValid() const;
      };
      
      class QmlTest : public QObject
      {
      	Q_OBJECT
      	QML_ELEMENT
      	QML_SINGLETON
      
      	Q_PROPERTY(QmlTestSubProperty* appData READ getAppData CONSTANT)
      
      	QmlTestSubProperty* obj = new QmlTestSubProperty();
      
      	public:
      		[[nodiscard]] QmlTestSubProperty* getAppData() const;
      
      	public:
      		QmlTest();
      		~QmlTest();
      };
      

      The program works and gives we correct result but qmllint do not like that.

      console.log("found property: " + QmlTest.appData.valid)
      
      Warning: /tmp/b/QmlDummy/Main.qml:9:44: Type "QmlTestSubProperty" of property "appData" not found. This is likely due to a missing dependency entry or a type not being exposed declaratively. [unresolved-type]
                      console.log("found property: " + QmlTest.appData.valid)
                                                              ^^^^^^^
      

      Both components are listed in qmltypes.

      Module {
          Component {
              file: "qml.h"
              name: "dummy::QmlTest"
              accessSemantics: "reference"
              prototype: "QObject"
              exports: ["Stuff/QmlTest 254.0"]
              isCreatable: false
              isSingleton: true
              exportMetaObjectRevisions: [65024]
              Property {
                  name: "appData"
                  type: "QmlTestSubProperty"
                  isPointer: true
                  read: "getAppData"
                  index: 0
                  isReadonly: true
                  isConstant: true
              }
          }
          Component {
              file: "qml.h"
              name: "dummy::QmlTestSubProperty"
              accessSemantics: "reference"
              prototype: "QObject"
              exports: ["Stuff/QmlTestSubProperty 254.0"]
              exportMetaObjectRevisions: [65024]
              Property {
                  name: "valid"
                  type: "bool"
                  read: "isValid"
                  index: 0
                  isReadonly: true
                  isConstant: true
              }
          }
      }
      

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-124294
          # Subject Branch Project Status CR V

          Activity

            People

              qtqmlteam Qt Qml Team User
              misery André Klitzing
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes