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

qmllint should consider QML2_IMPORT_PATH for import paths



    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • 6.9
    • 6.5
    • QML: Tooling
    • None
    • Fedora 38


      When developing KDE software I typically install everything into a folder in my home directory, e.g. "~/kde6/usr" and run things from there by setting environment variables like PATH, QT_PLUGIN_PATH and QML2_IMPORT_PATH to point to it. This includes QML modules like kirigami, which is e.g. installed to "/home/nico/kde6/usr/lib64/qml/org/kde/kirigami". QML2_IMPORT_PATH is then set to /home/nico/kde6/usr/lib64/qml.

      This works fine for running the application, however there is a problem when trying to use qmllint on it

      When running qmllint on a source file that imports Kirigami without further arguments I get a warning like


      Warning: /home/nico/qmltest/main.qml:5:1: Warnings occurred while importing module "org.kde.kirigami": [import]
      import org.kde.kirigami 2 as Kirigami
      Warning: Failed to import org.kde.kirigami. Are your import paths set up properly? [import]

      I can fix the warning by manually adding "-I /home/nico/kde6/usr/lib64/qml" to the qmllint call. That's tedious though.

      When using the "make all_qmllint" target provided by qt_add_qml_module there seems to be no way for me to manually add the necessary import path, so I can't make it find Kirigami.

      As a possible solution to this problem I suggest that qmllint could add the paths from QML2_IMPORT_PATH to the default search paths. That would fix running "make all_qmllint" in my setup.




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



            sami.shalayel Sami Shalayel
            nicolasfella Nicolas Fella
            0 Vote for this issue
            4 Start watching this issue