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. Import of module in Javascript does not respect qmldir->prefer
Forum Update on Monday, May 27th 2025

Import of module in Javascript does not respect qmldir->prefer

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 153 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.
  • S Offline
    S Offline
    skaldesh
    wrote on 20 Sept 2024, 09:57 last edited by
    #1

    In my root.qml file I import a QML module A that includes a Javascript resource a.js. In this javascript resource, I import a second QML module B that also includes a Javascript resource b.js. From a.js I then call a function from b.js. The unfortunate thing is that when modifying b.js and restarting the application, the changes are not loaded. I have to rebuild the whole application first.

    I have setup my application with two configurations, release and debug. When in debug, I load the .qml files from local disk instead of the Qt resource system to enable developers to quickly iterate on styling drafts without having to rebuild the application everytime.

    This is done by loading the root.qml file in my C++ main.cpp already from a local file path. And in addition every module includes the line prefer ./path/to/module to make the modules also load from disk.

    This setup works almost everywhere, except in the case described above. Somehow the .import directive does not respect the prefer line of the QML module when importing, causing it to load it from, I guess, the Qt resource system?
    When importing the same module B from a QML file, the loading from disk works flawlessly.
    So my only problem is really when a Javascript file imports a module.

    Does somebody know, how I could fix or workaround this issue? I am using CMake to build my application.

    1 Reply Last reply
    0

    1/1

    20 Sept 2024, 09:57

    • Login

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