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. Can't get property values of text inside onCompleted
Qt 6.11 is out! See what's new in the release blog

Can't get property values of text inside onCompleted

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 351 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.
  • D Offline
    D Offline
    Deyan
    wrote on last edited by Deyan
    #1

    Hi. I was wondering how to get the values of parent properties in onCompleted. I can't read value of property which is set in c++ when reading it from onCompleted, too. My goal is to set the position of the text which does not depend on rotation of the image.
    I stuck here:

    Item {

    id:myThing
    property int rotationAngle: 0 //this property is set in c++ side
    

    Image {

        id: myImage
        antialiasing: true
        x: xCoordinate
        y: yCoordinate
        width: elementWidht
        height: elementHeight
        rotation: rotationAngle
        fillMode: cellFill
        smooth: cellSmooth
    
        source: "qrc:/pics/folder/Frame.svg"
    
        property string cname: "myImage"
    
        Component.onCompleted: {
            console.log(cname, "successfully created!");
        }
    
        //print caption
        property alias text3: caption.text
    
    
             Text {
                 horizontalAlignment: Text.AlignHCenter
                 verticalAlignment: Text.AlignVCenter
                 id: caption
                 //width: parent.width
                 height: 29
                 color: "red"
                 text: "dynamically changed text..."
                 font.pointSize: 9
                 rotation: 360- parent.rotation  //here parent rotation is not 0
    
               
                   Component.onCompleted: {
                        
                        console.log(parent.rotation) // here rotation is 0...?
                        if(rotationAngle == 180)
                        {
                            console.log("here")
                            anchors.top =parent.bottom
    
                        }
                   }
    }
    

    }

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lemons
      wrote on last edited by
      #2
      color:"blue" 
      if(rotationAngle == 180)
      //
      // ==>
      color = "blue"
      if(rotation == 180)
      
      D 1 Reply Last reply
      0
      • L lemons
        color:"blue" 
        if(rotationAngle == 180)
        //
        // ==>
        color = "blue"
        if(rotation == 180)
        
        D Offline
        D Offline
        Deyan
        wrote on last edited by
        #3

        @lemons I have already tried with rotation, parent.rotation etc. etc. It does not work.

        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