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

problem with property alias

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 3 Posters 403 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 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 ODБOïO 2 Replies Last reply
    0
    • C cosmoff

      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 last edited by
      #2

      Hi @cosmoff,

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

      1 Reply Last reply
      0
      • C cosmoff

        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
        ODБOïO Offline
        ODБOïO Offline
        ODБOï
        wrote on 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

        • Login

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