How do I change imagesize to fit on other screens and preserve aspect ratio
-
I have explicity set x and y for the moment. I want to anchor but doesn't know how when the the pins are not position in the center of the image, only positioning so it is in the center of the circles.
Image { id: visare source: "images/visare_2_skugga.png" x: 113 y: 271 width: 210 height: 13 transformOrigin: Item.Right opacity: 1 rotation: needleAngle smooth: true Behavior on rotation{ SpringAnimation{ spring: 0.5; damping: 0.2; mass:2; } } } Image { id: visare_rpm source: "images/visare_2_skugga.png" x: 912 y: 270 width: 210 height: 13 transformOrigin: Item.Right opacity: 1 rotation: needleRpm smooth: true Behavior on rotation{ SpringAnimation{ spring: 0.5; damping: 0.2; mass:2; } } }
-
I have explicity set x and y for the moment. I want to anchor but doesn't know how when the the pins are not position in the center of the image, only positioning so it is in the center of the circles.
Image { id: visare source: "images/visare_2_skugga.png" x: 113 y: 271 width: 210 height: 13 transformOrigin: Item.Right opacity: 1 rotation: needleAngle smooth: true Behavior on rotation{ SpringAnimation{ spring: 0.5; damping: 0.2; mass:2; } } } Image { id: visare_rpm source: "images/visare_2_skugga.png" x: 912 y: 270 width: 210 height: 13 transformOrigin: Item.Right opacity: 1 rotation: needleRpm smooth: true Behavior on rotation{ SpringAnimation{ spring: 0.5; damping: 0.2; mass:2; } } }
-
because the gauge circle have the measure 1440x540 like the rest of the images there are two cirles in one circle. If i use anchors.centerIn it will end up in the center of the image in between those circles.
@antemort Wow this is way too different than what I understood earlier.
You have a large image and it has some circles at some positions and you want that pins to be centered to that circles. Is it ? And for that you have hard-coded the pin'sx
andy
positions by trial and error method (i.e manually). If thats the case then I think you should change the implementation. It would be too difficult to maintain that position when the image resizes.
Can you describe/explain it pictographically ? -
http://postimg.org/image/62lrab1jt/
here it is. Print screen from Qt designer with pins in right position
-
http://postimg.org/image/62lrab1jt/
here it is. Print screen from Qt designer with pins in right position
@antemort Hmm this is what I guessed and was afraid of. I thinks it a bad idea to go for this way of implementation. Instead you should divide it into seperate images. One being that speedometer image while other being the background. Then you can just use
Image
element to load that speedometer image and you will thus will able to place it anywhere. Now, the pins can be made child of speedometerImage
element and can be centered to that of the speedometer (parent) usinganchors.centerIn
.
In this way it will be independent of any resolution changes. -
I had it before but then I needed to position all images and then I couldn't anchor them. when I don't anchor them they doesn't scale or follow the window when it scales.