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. Problem with adding custom qml module
Forum Updated to NodeBB v4.3 + New Features

Problem with adding custom qml module

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 3 Posters 1.5k Views 1 Watching
  • 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
    dominik_j
    wrote on last edited by
    #1

    Hey,

    I am writing a QML-application, where a self written module needs to be imported and used. If I put my module in the locations provided in the QtQuick2ApplicationViewer viewer.engine()->importPathList(); everything works fine. Now I wanted to add the location where my module is located using the method viewer.addImportPath("/Users/userName/my/location/to/module");

    If I call this method with the correct location my module is still not found. Even if I look directly afterwards at the list provided with the import paths, my path seems not to be added. Am I missing a step or doing something wrong?

    1 Reply Last reply
    0
    • C Offline
      C Offline
      chrisadams
      wrote on last edited by
      #2

      Hrm, sounds like a bug. Ask aalpert on the #qt-labs channel on freenode irc.
      You can run the application with QML_IMPORT_TRACE=1 set in your environment, to get more debugging output.

      Cheers,
      Chris.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Spanken
        wrote on last edited by
        #3

        I made my own qml module earlier today. What I did was to set the environment variable QML2_IMPORT_PATH to the absolute search path to my module folder.

        It's important that you set a global environment variable. This because when running your qml from Qt Creator you don't seem to run it as your user.

        I'm on a mac so I set it in the /etc/launchd.conf file as such
        setenv QML2_IMPORT_PATH /path/to/your/module

        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