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. Horizontally flipping component changes x position

Horizontally flipping component changes x position

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 461 Views 1 Watching
  • 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.
  • E Offline
    E Offline
    eragon
    wrote on last edited by
    #1

    I am attempting to horizontally flip a QML component. I have the below shape:

    enter image description here

    And I am attempting to flip/reflect it horizontally to produce:

    enter image description here

    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?

    enter image description here

    In the below ignore the blue label. The green line should sit more right, ie, have the same x position as the above.

    enter image description here

    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)
        }
    }
    
    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Maybe try the Rotation API instead? It's simpler.

      (Z(:^

      1 Reply Last reply
      1

      • Login

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