Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QML change rotation origin
Forum Updated to NodeBB v4.3 + New Features

QML change rotation origin

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 248 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.
  • ivanicyI Offline
    ivanicyI Offline
    ivanicy
    wrote on last edited by
    #1

    Hello!

    I have this items built with this code:

    MapItemView {
                    id: item
                    MapCircle {
                        id: circle
                        center {
                            latitude: 40.353586
                            longitude: -3.745564
                        }
                        radius: 5.0
                        color: '#BF008000'
                        border.width: 3
                    }
    
                    MapPolygon {
                        id: polygon
                        color: '#BF008000'
                        path: [
                            { latitude: 40.353586, longitude: -3.745564 },
                            { latitude: 40.354060, longitude: -3.745146 },
                            { latitude: 40.353772, longitude: -3.744883 }
                        ]
                    }
    
                    transform: Rotation {
                        id: rotate
                        angle: 0
                        origin.x: (circle.TopLeft + circle.width) / 2
                        origin.y: (circle.TopLeft + circle.height) / 2
                    }
                }
    

    5d3aa2b7-3836-4df1-9636-f068c0b28553-image.png

    I need to rotate it putting the origin in the center of the circle. Now, with this code, the movement isn't correct at all when I rotate it:

    6f3f3d92-63f7-47bb-82af-f1e9d6b2ae2f-image.png

    I need the circle keeps its position.

    Do you know how to do it?

    Thank you very much!

    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