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

qmllint does not resolve C++ type from a module, but other types work

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • Some future release
    • 6.5.0
    • QML: Tooling
    • None
    • All

      We have recently started using qmllint and find it very helpful. Most of its warnings where useful and helped us clean up the code.

      However there is one warning that we can not understand or resolve. qmllint warns:

      [build] Warning: /home/user/Src/Project/qml/FlickableScene.qml:357:75: Type "bda::ColorTransferListModel" of property "colorTransferListModel" not found. This is likely due to a missing dependency entry or a type not being exposed declaratively. [unresolved-type]
      [build]                         colorTransferListModel: mFlickableSceneController.colorTransferListModel
      [build]                                                                           ^^^^^^^^^^^^^^^^^^^^^^
      

      The corresponding code reads:

                  Item {
                      id: mainControlsContainerItem
                      visible: mainControlsContainer.currentIndex >= 0
      
                      Rectangle {
                          anchors.fill: parent
                          color: "#F3F3F3"
                      }
                      SingleItemView {
                          id: mainControlsContainer
                          currentIndex: mainControlsIconsPanel.currentIndex
      
                          OpenedItemsList {
                              id: samplesListView
                              enabled: !mFlickableSceneController.isLoadingSamples
                          }
                          ColorControlsMenu {
                              id: colorControlsMenu
                              // Warning is from here:
                              colorTransferListModel: mFlickableSceneController.colorTransferListModel
                          }
      

      The property is exported from header FlickableSceneController.hh:

          Q_PROPERTY(bda::ColorTransferListModel* colorTransferListModel READ getColorTransferListModel CONSTANT FINAL)
      

      And the underlying type comes from a C++ class bda::ColorTransferListModel that is defined in a qml module. We can see that the type is exported from the qmltypes file:

      import QtQuick.tooling 1.2
      
      // This file describes the plugin-supplied types contained in the library.
      // It is used for QML tooling purposes only.
      //
      // This file was auto-generated by qmltyperegistrar.
      
      Module {
          Component {
              file: "ColorTransferListModel.hh"
              name: "bda::ColorTransferListModel"
              accessSemantics: "reference"
              prototype: "QObject"
              exports: ["BDAQtQuick/ColorTransferListModel 1.0"]
              exportMetaObjectRevisions: [256]
              Property {
                  name: "colorTransferModelList"
                  type: "std::vector<bda::ColorTransferModel*>"
                  read: "getColorTransferModelList"
                  notify: "colorTransferModelListChanged"
                  index: 0
                  isReadonly: true
                  isFinal: true
              }
              Signal {
                  name: "sigColorTransferModelChanged"
                  Parameter { name: "aChannelName"; type: "std::string" }
              }
              Signal { name: "colorTransferModelListChanged" }
          }
      [...]
      

      Other types are resolved correctly. Are we doing something wrong?

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

            qtqmlteam Qt Qml Team User
            emmenlau Mario Emmenlauer
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes