Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Module location transparency, flawed ?



  • I've got the following files hierarchy somewhere:
    @
    mysdk/
    ---mywidgets/
    ---widget1.qml
    ---widget2.qml
    ---qmldir
    ---tools/
    ---myLoader.qml
    ---qmldir
    @

    and in myLoader.qml, i've got the following code

    @
    import Qt 4.7

    Item {
    ...
    property alias loadComponent: loader.sourceComponent
    Loader {
    id: loader
    }
    }
    @

    I set the QT_MPORT_PATH and when I try something like this:

    @
    import Qt 4.7
    import mysdk.mywidgets 1.0
    import mysdk.tools 1.0

    item {
    MyLoader {
    loadComponent: Widget1
    }
    }
    @

    It does not work! the Widget1 is not resolved. The only solution is to use a "../widget1.qml" kind of url and that's exactly what i do not want.

    Is there a way to do this or is this limitation is wanted/known/featured ?--



  • bump?

    i tried:

    @
    import Qt 4.7
    import mysdk.mywidgets 1.0 as MyW
    import mysdk.tools 1.0

    item {
    MyLoader {
    loadComponent: MyW.Widget1
    }
    }
    @

    but it's the same problem :/


  • Moderators

    Try uppercase for the first letter of your component. QML is case sensitive, even wrt. filenames used.


Log in to reply