Solved Transform origin of an Item
-
I have a Rectangle where I want to plot some images and I need the origin to be at the center of this rectangle. So that when I place my image at (0,0), It gets automatically placed at the center of my rectangle . I have implemented this by adding an offset to the x and y attribute of my image.
Is there a better way of doing this, where I don't have to add an offset every time I want to add an image ?
-
Sure, use
Translate
:Image { ... transform: Translate { ... } }
-
@Luckless said in Transform origin of an Item:
Is there a better way of doing this, where I don't have to add an offset every time I want to add an image ?
I don't think so, the origin (0,0) is left upper corner in Qt. You have to translate it to what ever other origin you want to have.
For QML see what @IntruderExcluder suggested.
-
Sure, use
Translate
:Image { ... transform: Translate { ... } }