Unsolved Horizontally flipping component changes x position
-
I am attempting to horizontally flip a QML component. I have the below shape:
And I am attempting to flip/reflect it horizontally to produce:
I can flip the component using
Matrix4x4
(see below code) but it also changes the x position. See below image.How can I preserve the x position when flipping the component? Ie, how can I keep it in the same place?
In the below ignore the blue label. The green line should sit more right, ie, have the same x position as the above.
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 } } transform: Matrix4x4 { matrix: Qt.matrix4x4(-1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1) } }
-
Maybe try the Rotation API instead? It's simpler.