Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML2_IMPORT_PATH not working?
Forum Updated to NodeBB v4.3 + New Features

QML2_IMPORT_PATH not working?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 1 Posters 563 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Diracsbracket
    wrote on 6 Jun 2021, 05:25 last edited by Diracsbracket 6 Jun 2021, 06:09
    #1

    Hi.
    I am trying to run the qmltests test program from bluez-qt.
    I cross-built from source and deployed bluez-qt to the Pi4 in /usr/local.

    The tests are being built alright, but are not automatically deployed, so I copied them manually to /home/pi/test-bluez-qt/bin and additionally copied the autotests dir from the bluez-qt source dir to it, to have access to the tst_***.qml files apparently required by qmltests.

    Then, I try to run qmltests as follows:

    pi@raspberrypi:~/test-bluez-qt$ QML_IMPORT_TRACE=1 LD_LIBRARY_PATH=/home/pi/test-bluez-qt/bin QML2_IMPORT_PATH=/usr/local/lib/qml ./bin/qmltests
    

    This gives the following output:

    QQmlImportDatabase::addImportPath: "/usr/local/Qt5.15.2/qml"
    QQmlImportDatabase::addImportPath: "/home/dirac/build-bluez-qt-Pi4B-Debug/autotests/../src/imports"
    QQmlImportDatabase::addImportPath: "qrc:/qt-project.org/imports"
    QQmlImportDatabase::addImportPath: "/home/pi/test-bluez-qt/bin"
    QQmlImports(file:///home/pi/test-bluez-qt/bin/autotests/qml/tst_adapter.qml)::addLibraryImport: "QtTest" 1.0 as ""
    QQmlImports(file:///home/pi/test-bluez-qt/bin/autotests/qml/tst_adapter.qml)::importExtension: loaded "/usr/local/Qt5.15.2/qml/QtTest/qmldir"
    QQmlImportDatabase::registerPluginTypes: "QtTest" from "/usr/local/Qt5.15.2/qml/QtTest"
    QQmlImports(file:///home/pi/test-bluez-qt/bin/autotests/qml/tst_adapter.qml)::addLibraryImport: "QtQuick" 2.2 as ""
    QQmlImports(file:///home/pi/test-bluez-qt/bin/autotests/qml/tst_adapter.qml)::importExtension: loaded "/usr/local/Qt5.15.2/qml/QtQuick.2/qmldir"
    QQmlImportDatabase::registerPluginTypes: "QtQuick" from "/usr/local/Qt5.15.2/qml/QtQuick.2"
    QQmlImports(file:///home/pi/test-bluez-qt/bin/autotests/qml/tst_adapter.qml)::addLibraryImport: "org.kde.bluezqt.fakebluez" 1.0 as ""
    file:///home/pi/test-bluez-qt/bin/autotests/qml/tst_adapter.qml:10:1: module "org.kde.bluezqt" is not installed
         import org.kde.bluezqt 1.0 as BluezQt
         ^
    pi@raspberrypi:~/test-bluez-qt$
    

    The error is:

    file:///home/pi/test-bluez-qt/bin/autotests/qml/tst_adapter.qml:10:1: module "org.kde.bluezqt" is not installed
         import org.kde.bluezqt 1.0 as BluezQt
         ^
    

    However, the path set in QML2_IMPORT_PATH i.e. /usr/local/lib/qml contains the org.kde.bluezqt module:

    pi@raspberrypi:/usr/local/lib/qml/org/kde/bluezqt$ ls
    DevicesModel.qml  libbluezqtextensionplugin.so  qmldir
    pi@raspberrypi:/usr/local/lib/qml/org/kde/bluezqt$
    

    and qmldir is as follows:

    pi@raspberrypi:/usr/local/lib/qml/org/kde/bluezqt$ cat qmldir
    module org.kde.bluezqt
    plugin bluezqtextensionplugin
    
    DevicesModel 1.0 DevicesModel.qml
    

    How can I resolve this?
    Thanks!

    D 1 Reply Last reply 6 Jun 2021, 05:55
    0
    • D Diracsbracket
      6 Jun 2021, 05:25

      Hi.
      I am trying to run the qmltests test program from bluez-qt.
      I cross-built from source and deployed bluez-qt to the Pi4 in /usr/local.

      The tests are being built alright, but are not automatically deployed, so I copied them manually to /home/pi/test-bluez-qt/bin and additionally copied the autotests dir from the bluez-qt source dir to it, to have access to the tst_***.qml files apparently required by qmltests.

      Then, I try to run qmltests as follows:

      pi@raspberrypi:~/test-bluez-qt$ QML_IMPORT_TRACE=1 LD_LIBRARY_PATH=/home/pi/test-bluez-qt/bin QML2_IMPORT_PATH=/usr/local/lib/qml ./bin/qmltests
      

      This gives the following output:

      QQmlImportDatabase::addImportPath: "/usr/local/Qt5.15.2/qml"
      QQmlImportDatabase::addImportPath: "/home/dirac/build-bluez-qt-Pi4B-Debug/autotests/../src/imports"
      QQmlImportDatabase::addImportPath: "qrc:/qt-project.org/imports"
      QQmlImportDatabase::addImportPath: "/home/pi/test-bluez-qt/bin"
      QQmlImports(file:///home/pi/test-bluez-qt/bin/autotests/qml/tst_adapter.qml)::addLibraryImport: "QtTest" 1.0 as ""
      QQmlImports(file:///home/pi/test-bluez-qt/bin/autotests/qml/tst_adapter.qml)::importExtension: loaded "/usr/local/Qt5.15.2/qml/QtTest/qmldir"
      QQmlImportDatabase::registerPluginTypes: "QtTest" from "/usr/local/Qt5.15.2/qml/QtTest"
      QQmlImports(file:///home/pi/test-bluez-qt/bin/autotests/qml/tst_adapter.qml)::addLibraryImport: "QtQuick" 2.2 as ""
      QQmlImports(file:///home/pi/test-bluez-qt/bin/autotests/qml/tst_adapter.qml)::importExtension: loaded "/usr/local/Qt5.15.2/qml/QtQuick.2/qmldir"
      QQmlImportDatabase::registerPluginTypes: "QtQuick" from "/usr/local/Qt5.15.2/qml/QtQuick.2"
      QQmlImports(file:///home/pi/test-bluez-qt/bin/autotests/qml/tst_adapter.qml)::addLibraryImport: "org.kde.bluezqt.fakebluez" 1.0 as ""
      file:///home/pi/test-bluez-qt/bin/autotests/qml/tst_adapter.qml:10:1: module "org.kde.bluezqt" is not installed
           import org.kde.bluezqt 1.0 as BluezQt
           ^
      pi@raspberrypi:~/test-bluez-qt$
      

      The error is:

      file:///home/pi/test-bluez-qt/bin/autotests/qml/tst_adapter.qml:10:1: module "org.kde.bluezqt" is not installed
           import org.kde.bluezqt 1.0 as BluezQt
           ^
      

      However, the path set in QML2_IMPORT_PATH i.e. /usr/local/lib/qml contains the org.kde.bluezqt module:

      pi@raspberrypi:/usr/local/lib/qml/org/kde/bluezqt$ ls
      DevicesModel.qml  libbluezqtextensionplugin.so  qmldir
      pi@raspberrypi:/usr/local/lib/qml/org/kde/bluezqt$
      

      and qmldir is as follows:

      pi@raspberrypi:/usr/local/lib/qml/org/kde/bluezqt$ cat qmldir
      module org.kde.bluezqt
      plugin bluezqtextensionplugin
      
      DevicesModel 1.0 DevicesModel.qml
      

      How can I resolve this?
      Thanks!

      D Offline
      D Offline
      Diracsbracket
      wrote on 6 Jun 2021, 05:55 last edited by Diracsbracket 6 Jun 2021, 06:12
      #2

      I ended up copying the org dir to the ~/test-bluez-qt/bin dir so that it is in the default module search path as described at
      https://doc.qt.io/qt-5/qtqml-syntax-imports.html#qml-import-path

      I could also have copied the whole module dir to my Qt installation's qml dir in /usr/local/Qt5.15.2/qml, as suggested by the trace output from the above test:

      QQmlImportDatabase::addImportPath: "/usr/local/Qt5.15.2/qml"
      

      The qml test then runs correctly.
      But still no idea why using the QML2_IMPORT_PATH does not work

      1 Reply Last reply
      0

      1/2

      6 Jun 2021, 05:25

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved