Load qmldir from QRC file

前端 未结 1 1336
温柔的废话
温柔的废话 2020-12-15 10:51

I\'m trying to use the QML-material library in a Qt Quick Application.

But when I try to use the import code it says

module \"Material\" is

1条回答
  •  温柔的废话
    2020-12-15 11:34

    You need to add to the import path the folder where the modules are located.

    In this case it's qrc:/modules/.

    Example:

    engine.addImportPath( "qrc:///modules" );
    

    For a module to work you need to have access to the qmldir file, but also all the files referenced in it. So you need to add all the files of the library to the the qrc.

    0 讨论(0)
提交回复
热议问题