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_PATH has zero practical effect on qmlls
Forum Updated to NodeBB v4.3 + New Features

IMPORT_PATH has zero practical effect on qmlls

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 1 Posters 324 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.
  • J Offline
    J Offline
    Jessia Clinkscale
    wrote on last edited by Jessia Clinkscale
    #1

    The title is a rant. I cannot get QML modules in a subdirectory to work at all.

    The MyModule_lib is a CMake target which contains a perfectly working QML module (that prints "hello world" on construction), and in the main target, qmlls can find it if it's a direct subdirectory of the main project that matches its URI (./MyModule). However, as soon as I move it into a nested directory (./modules/MyModule), then nothing works at all.

    add_subdirectory(modules/MyModule)
    
    qt_policy(SET QTP0005 NEW)
    
    qt_add_qml_module(
      apphello_world
      URI               hello_world
      IMPORT_PATH       ${CMAKE_BINARY_DIR}/modules
      VERSION           1.0
      DEPENDENCIES      QtQuick
      IMPORTS           TARGET MyModule_lib
      QML_FILES         Main.qml)
    

    qmlls will happily complain

    Failed to import MyModule. Are your import paths set up properly? [import]
    Warnings occurred while importing module "MyModule": [import]
    

    If someone can provide a minimal example where there's a QML module (qt_add_library(XXX)) nested within a directory to be properly consumed by the main executable target, with qmlls actually parsing its contents, I would greatly appreciate it.

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Jessia Clinkscale
      wrote on last edited by
      #2

      Turns out it wasn't me doing something wrong. It was a Qt bug: https://bugreports.qt.io/browse/QTCREATORBUG-31949

      1 Reply Last reply
      0
      • J Jessia Clinkscale has marked this topic as solved on

      • Login

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