Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

Image alignment does not appear to work?

$
0
0
I am trying to set an image’s alignment so that its point of origin is its centre. I would like it so that if the image is at position 0, 0 then, it is the [i]centre[/i] of the image that is at 0, 0 – the left and top sides of the image extending beyond its parent’s bounds for example. It would also mean that when i query the images position, i can know where the centre of the image is without having to calculate it every time. I assumed this was the whole point of the images alignment properties, so i tried to set them like this:         horizontalAlignment: Image.AlignHCenter         verticalAlignment: Image.AlignVCenter However they do not appear to do anything? (And if you read them back you get strange values like 4 for horizontalAlignment and 128 for verticalAlignment – i appreciate they are an enumeration but that is just strange). If this is not how I am supposed to be doing this then it would be nice to know! Also, why are these horizontalAlignment and verticalAlignment properties only specific to image? It would be useful if you could also specify them for any item – for example to change the origin / alignment of a rectangle. I appreciate that in most cases you would use anchoring, but i cannot anchor this image as i need to be able to move it via the cursor keys, and want the centre of the image to be its position! Hope this makes sense. Thanks!

Viewing all articles
Browse latest Browse all 4972

Trending Articles