Gestures in 4.7.1 behavior change
October 20, 2010 by Frederik Gladhorn | Comments
Fixing bugs sometimes means changing behavior. The gesture framework is still pretty fresh in Qt. It made its first appearance in Qt 4.6, but only now with Qt 4.7 is it going to be used big time. Sadly we found this bug too late to integrate it into Qt 4.7.0, but it seems important enough to be in 4.7.1.
The pinch gesture has a property that represents the zoom factor. This used to be initialized with the value 0.0 and the total scale factor would be the sum of all scale factors... just like rotations, where the angle is added up.
Well, we admit, that was a bit of a thinking mistake. Scaling is a multiplicative property. So from Qt 4.7.1 on this horrible mistake has been fixed to give you easy to use zooming. We think this is so important that it needs to be in Qt now, since it's a behavior change and we want to enable Qt to be used on devices.
So if you have a picture and you want to use two fingers to scale it, now all you have to do to make the picture scaling follow the fingers is to multiply the scaling by QPinchGesture::scaleFactor() and you are good :)
So what do we have in QPinchGesture?
- scaleFactor - whenever you get a gesture event, you can multiply by this value to update your item.
- totalScaleFactor - this is the scale factor since the beginning of the pinch - if you just care about the final scaling, this is what you want.
The commit in Qt's 4.7 branch is this one:
Subscribe to our newsletter
Try Qt 6.5 Now!
Download the latest release here: www.qt.io/download.
Qt 6.5 is the latest Long-Term-Support release with all you need for C++ cross-platform app development.
Explore Qt World
Check our Qt demos and case studies in the virtual Qt World
Check out all our open positions here and follow us on Instagram to see what it's like to be #QtPeople.
Näytä tämä julkaisu Instagramissa.
Want to build something for tomorrow, join #QtPeople today! We have loads of cool jobs you don't want to miss! http://qt.io/careers #builtwithQt #software #developers #coding #framework #tool #tooling #C++ #QML #engineers #sales #tech #technology #UI #UX #CX #Qt #Qtdev #global #openpositions #careers #job
Henkilön Qt (@theqtcompany) jakama julkaisu