Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Applying a mirror transformation to flip/reflect a QML Control

Can I horizontally flip/reflect a shape item in QML. For example; I have the below shape:

enter image description here

Can I flip/reflect it horizontally to produce:

enter image description here

I know I could edit my QML code to draw the lines differently but it would be much simpler to just use a QML animation or something to flip it if thats possible.

Shape {
    id: annotationHLine;
    anchors.left: annotationShp.right;
    anchors.top: annotationShp.top;
    anchors.topMargin: annotationShp.height * 0.5;

    ShapePath {
        strokeWidth: 2;
        strokeColor: "Green";
        fillColor: "transparent";
        startX: -slant; startY: 0;
        PathLine { x: relativeTargetX*0.5; y: 0 }
        PathLine { x: relativeTargetX; y: relativeTargetY }
    }
}
like image 536
sazr Avatar asked Oct 12 '25 07:10

sazr


1 Answers

You can use transform and Scale:

transform: Scale{ xScale: -1 }
like image 95
Miftakhul Arzak Avatar answered Oct 15 '25 14:10

Miftakhul Arzak