Problems with Open-Source Downloads read and

Import QML File from QRC

  • Hello Guys,
    my main.qml is in qml.qrc// directory.
    my import file is also in this qrc directory.
    i try this paths
    import "qrc:/importFile.qml" as ImportFile
    import "qrc:///importFile.qml" as ImportFile
    import "importFile.qml" as ImportFile
    but is not working

    thanks in the advance for the help

  • If both qml files have the same prefix (in your case, /), you don't need to import it. Use the filename without extension to instantiate it.

  • yes both files have the prefix / but this path
    import "importFile.qml" as ImportFile
    is not working the error is that
    QML debugging is enabled. Only use this in a safe environment.
    QQmlApplicationEngine failed to load component
    qrc:///main.qml:4 "collectionView.qml": no such directory
    maybe i must change my main.cpp file ?

  • Once again, you don't need to import it. You should be able to instantiate it without a problem.

    importFile {
         id: test

  • ahh okay thank you ^^

Log in to reply