Important: Please read the Qt Code of Conduct -

[Solved]Loader, set Component as SourceComponent using JavaScript-Function

  • Hello,

    i would really like to set a Component as the sourceComponent of my Loader.
    @Loader {
    id: compLoader
    x: 20; y: 20
    width: 300; height: 300
    sourceComponent: Rectangle { }
    It works fine that way, but i would like to dynamically assign the sourceComponent using Javscript:
    @function setSrcComp(){
    compLoader.sourceComponent = Rectangle
    Well, that doesn't work.
    Is there any workaround?

    -- Attach --

    Currently reading into dynamic qml object creating, maybe this is what i am searching for.

    -- Solved --

    I am using dynamic object creation instead of a loader now.

Log in to reply