problem with property alias

  • Hello,

    I show you an extract of code, it will be simpler :


    property alias image : im.source
    image : "pics/linux.jpeg"
    id : im
    //source : "pics/linux.jpeg"

        the alias does not work however it should be. the problem does not come from image "pics/linux.jpeg" because I display the image when I uncommented //source : "pics/linux.jpeg" so the probleme comes from the alias
        do you have an idea to solve my problem ?
        thanks a lot

  • Hi @cosmoff,

    Could you please explain clearly that what you want to achieve?

  • hi @cosmoff said in problem with property alias:


    it's actually hard to understand what you are asking exactly, please try to use topic tools 'correctly' so the code is nicely formatted and easy to read.

    //MyImage.qml   a custom qml Component 
     id: root // top level component 
     property alias img : im

    now lets use the MyImage Component

    // somewhere in main.qml for example

       // whe can access the alias to manipulate the Image element of our MyImage Component
    img.source  : "pics/linux.jpeg"

Log in to reply