Qt5 QML module is not installed

前端 未结 5 2003
温柔的废话
温柔的废话 2020-12-24 13:50

I\'m confused about modules in Qt QML. I\'ve read all the docs, but it doesn\'t make clear some basic ideas.

I understand that i can put a bunch of QML files into a

5条回答
  •  礼貌的吻别
    2020-12-24 14:36

    A similar issue cost me a bit of time so I just post it here to perhaps save the next guy some effort.

    My problem was that an invisible character had sneaked into the module name. Probably through copy and paste. Here my issue:

    Example error output:

    MyEngine failed to load component
    qrc:/qml/main.qml:53 Type MyComponent unavailable
    file:///Users//MyProject/qml/MyModule/MyComponent.qml:-1 No such file or directory
    

    It all looks fine and the path displayed is indeed the correct one. So what is wrong?

    Now, copy that path to a Terminal window:

    file:///Users//MyProject/qml/MyModule/MyComponent.qml
    

    There it is, the:

    ""
    

    Solved the issue by manually retyping the component name in the qmldir file, and thus effectively deleting the invisible character.

提交回复
热议问题