How to anchor to a rotated rectangle edge?



  • I want to draw few line in qml and to be relatively placed and used Rectangle with small width for it. Line 2 is rotated 45 degree. Line 3 is anchored to Line 1 and Line 2. The issue is when i anchor a Line 3 to Line 2, it takes points before rotated. Is there a way to resolve this?

    Rectangle {
        id: idLine1
        height: 2
        color: "white"
        width: idFluidStatus.width/3
        anchors.left: idRect.right
        anchors.verticalCenter: idRect.verticalCenter
    }
    
    Rectangle {
        id: idLine2
        height: 2
        color: "white"
        transformOrigin: Item.BottomLeft
        rotation: 45
        width: idFluidStatus.width/3
        anchors.left: idRect.horizontalCenter
        anchors.top: idLine1.bottom
    }
    
    Rectangle {
        id: idLine3
        height: 2
        color: "red"
        anchors.left: idLine2.right
        anchors.right: idLine1.right
        anchors.bottom: idLine2.bottom
    }
    
    

    I am not able to upload image to show the output


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.