Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. problem with property alias
Forum Update on Monday, May 27th 2025

problem with property alias

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 3 Posters 313 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cosmoff
    wrote on 24 Oct 2019, 11:51 last edited by cosmoff
    #1

    Hello,

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

        ```
    

    property alias image : im.source
    image : "pics/linux.jpeg"
    Image{
    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
    S O 2 Replies Last reply 24 Oct 2019, 11:57
    0
    • C cosmoff
      24 Oct 2019, 11:51

      Hello,

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

          ```
      

      property alias image : im.source
      image : "pics/linux.jpeg"
      Image{
      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
      S Offline
      S Offline
      sharath
      wrote on 24 Oct 2019, 11:57 last edited by
      #2

      Hi @cosmoff,

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

      1 Reply Last reply
      0
      • C cosmoff
        24 Oct 2019, 11:51

        Hello,

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

            ```
        

        property alias image : im.source
        image : "pics/linux.jpeg"
        Image{
        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
        O Offline
        O Offline
        ODБOï
        wrote on 24 Oct 2019, 12:00 last edited by ODБOï
        #3

        hi @cosmoff said in problem with property alias:

        simpler

        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 
        Rectangle{
         id: root // top level component 
         property alias img : im
          Image{
            id:im
          }
        }
        

        now lets use the MyImage Component

        // somewhere in main.qml for example

        MyImage{
           // whe can access the alias to manipulate the Image element of our MyImage Component
        
        img.source  : "pics/linux.jpeg"
        
        }
        
        1 Reply Last reply
        0

        1/3

        24 Oct 2019, 11:51

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved