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

[Solved]Loader with custom type



  • Startup element with a custom type error occurs:
    @CustomType is not a type@

    Loading item
    @
    Loader {
    id: loader
    source: "file:///home/user/MainSettings.qml"
    }
    @

    MainSettings.qml

    @
    import QtQuick 2.3
    Item {
    property QtObject delegates: Item {
    property var rect: Rectangle {color: "red"}
    property var flip: CustomType {}
    }
    }
    @

    CustomType.qml
    @ Item {

    }
    @

    MainSettings.qml is separate from the project


  • Moderators

    I suspect you need to import "home/user" folder, otherwise the Loader does not know where to look for CustomType.



  • [quote author="sierdzio" date="1406623459"]I suspect you need to import "home/user" folder, otherwise the Loader does not know where to look for CustomType.[/quote]

    Yes, because the files are located in the resource, need to import as:
    @import "qrc:///qml"@

    thx.


Log in to reply