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. [Solved] QML import path
QtWS25 Last Chance

[Solved] QML import path

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 5.8k 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.
  • A Offline
    A Offline
    albanj
    wrote on last edited by
    #1

    Hi,

    Please excuse the newb question. I suspect it's already been answered somewhere but I'm not really sure what to search for.

    I've followed the instructions to make and install "Bacon2D":https://github.com/Bacon2D/Bacon2D and that seemed to work ok.

    If I create a Qt Quick UI project I can put

    @importPaths: [ "/home/alec/Qt/imports" ]@

    in the .qmlproject file. This works and I can use the plugin.

    I've been trying to do the same with a Qt Quick Application project so I can build and test on Android. I imagine I need to use the .pro file and QML_IMPORT_PATH but haven't managed to get it working. I've tried paths to the import folder in my Qt directory, the Bacon2d directory downloaded and built. I'm not sure what format this line needs or if this is the right/only thing to do.

    @Starting /home/alec/dev/qt_projects/build-untitled1-Desktop_Qt_5_3_GCC_64bit-Debug/untitled1...
    QML debugging is enabled. Only use this in a safe environment.
    QQmlImportDatabase::addImportPath: "/home/alec/Qt/5.3/gcc_64/qml"
    QQmlImportDatabase::addImportPath: "/data/qt_projects/build-untitled1-Desktop_Qt_5_3_GCC_64bit-Debug"
    QQmlImports(qrc:///main.qml)::addLibraryImport: "QtQuick" 2.2 as ""
    QQmlImports(qrc:///main.qml)::importExtension: loaded "/home/alec/Qt/5.3/gcc_64/qml/QtQuick.2/qmldir"
    QQmlImportDatabase::registerPluginTypes: "QtQuick" from "/home/alec/Qt/5.3/gcc_64/qml/QtQuick.2"
    QQmlImports(qrc:///main.qml)::addLibraryImport: "QtQuick.Controls" 1.1 as ""
    QQmlImports(qrc:///main.qml)::importExtension: loaded "/home/alec/Qt/5.3/gcc_64/qml/QtQuick/Controls/qmldir"
    QQmlImportDatabase::registerPluginTypes: "QtQuick.Controls" from "/home/alec/Qt/5.3/gcc_64/qml/QtQuick/Controls"
    QQmlApplicationEngine failed to load component
    qrc:///main.qml:3 module "Bacon2D" is not installed@

    Is the output from QML_INPUT_TRACE=1

    Same situation on Lubuntu 14.04 and Manjaro 0.8.something

    Can anyone point me in the right direction? Is there any extra info I can give?

    1 Reply Last reply
    0
    • shavS Offline
      shavS Offline
      shav
      wrote on last edited by
      #2

      Hi,

      I use this code:
      @
      int main(int argc, char *argv[])
      {
      Application app(argc, argv);

      QtQuick2ControlsApplicationViewer viewer;
      viewer.addImportPath(Application::applicationDirPath()+"/com/shav/msl");
      viewer.addImportPath(Application::applicationDirPath()+"/com/shav/msl/qmldir");
      viewer.setMainQmlFile(QStringLiteral("qml/MslEditor/main.qml"));
      viewer.show();
      
      return app.exec();
      

      }
      @

      In QML files I've added this:
      @
      import com.shav.msl 1.0
      @

      Mac OS and iOS Developer

      1 Reply Last reply
      0
      • A Offline
        A Offline
        albanj
        wrote on last edited by
        #3

        Well I'm thoroughly confused.

        I got up this morning happy to see shav's post. I go to try it out but everything is already working. The only thing I can think of is that a system restart made Qt rejigger itself and recognise the stuff in its imports folder.

        Thanks shav for your reply.

        I'll mark the topic solved because I no longer have the problem. Marking it 'Waste of Everybody's Time' might be better though!

        1 Reply Last reply
        0

        • Login

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