Mirroring in Flipable
-
I'm trying to use Flipable's back to draw some elements (text, rectangles...). Based on examples distributed with Qt code, I've done something like this:
@
Flipable {
id: flipable
back: Rectangle {
Text {
text: 'some text'
}
}transform: Rotation { id: rotation origin.x: flipable.width/2 axis { y: 1; z: 0 } } states: State { name: 'back' PropertyChanges { target: rotation angle: 180 } }
}
@My problem is that the elements disposed in the back of the Flipable are being displayed mirrored, and this is a big problem, specially for text.
What is getting me confused is that the examples in Qt code don't seem to have the same problem. Am I doing something wrong?
Thanks
-
Hi,
The Rectangle used for "back" doesn't have a geometry set (it is 0x0), which seems to be what is causing the issue for Flippable. It you give it an explicit size (or size it to the Text item, etc), it should work properly.
Regards,
Michael -
Wow! I would never find it by myself! Thanks, Michael!
Is that behaviour intentional? Or is it more like a bug?
I'm asking it because it seems to be counterintuitive (at least for me) that a non-declared geometry property on a component has the side effect of a mirroring in it and its children. Why is it like this? -
Hi,
We calculate the transform for the back item by rotating it around the center x- and y-axis of the item. When the item has no geometry, the center is (0,0), which leads to flips. I'm not sure if there is a better method that could be used -- it certainly isn't intuitive to track down what's going wrong when you do hit this issue.
Regards,
Michael -
Hmm... I see. It does make sense after all, although it isn't really intuitive.
Thanks for your help