QMatrix vs QTransform
Currently I'm porting and cleaning old code from my application.
As QMatrix is already deprecated, I want to replace it using the
This is a little example about what I'm planning:
// Old code
// New code
I would like to read about previous experiences doing this
kind of operations. Suggestions? recommendations?
In the end both are matrices.
Well, I started to replace the code and in some points the "usual" behavior is not the same. I guess I will have to spend some time dealing with this.
Theoretically both are matrices... but in practice and after my first try I'm not so sure at all :P
And where is the different behavior?
I am looking at the documentation and I can see only one difference betweet this two.
QMatrix has m11, m12, 0, m21, m22, 0, dx, dy, 1.
QTransform is m11, m12, m13, m21, m22, m23, m31, m32, m33.
Notice the difference, in the QMatrix m13 and m23 are always 0. These members are used when doing projection.
So, final, with QMatrix you can't define projection transformation.
As feature of my app, I wrote a plugin to allow scaling for QGraphicsItems using mouse events. With QMatrix the transformation looks smooth. When I tried to use QTransform (as in my first post), the effect was ugly (slow, discontinuous). I guess I'm missing something.
In case you want to see something, here is the code (working with QMatrix for now):
Going to the point (line 177):
Any advice is very welcome.
I think it's time for bug report. I don't see why there is performance problems with scaling.