Details
-
Suggestion
-
Resolution: Done
-
P3: Somewhat important
-
None
-
None
-
None
-
b4d31c9ff5f0c5821ea127c663532d9fc2cae43e
Description
I'm experimenting with PinchHandler in order to make a canvas zoomable using pinch gestures. The canvas has its own zoomLevel property, so it doesn't make sense to modify its scale property. For that reason, I set the handler's target to null. The problem I encountered with this is that each pinch starts from the default scale (1), rather than persisting across pinches. A simple workaround for this is to use an empty Item:
PinchHandler { target: pinchStateItem } // ... Item { id: pinchStateItem onScaleChanged: if (canvas) canvas.currentPane.setZoomLevel(scale) }
I think it would be useful if PinchHandler maintained its transformation state when it has no target. I can't think of a scenario where you'd want to discard the state between pinches, but if there are valid use cases for that, a property would work too:
PinchHandler { target: null maintainState: true // persistent: true // persistentState: true // persistState: true }
Attachments
Issue Links
- is required for
-
QTBUG-69134 finish the autotest for PinchHandler
- Closed
- relates to
-
QTBUG-76379 PinchHandler should have a way to reset
- Closed
- resulted in
-
QTBUG-94168 pointer handlers need both gesture-duration and accumulated properties with setters
- Closed
For Gerrit Dashboard: QTBUG-68941 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
233123,3 | PinchHandler: rename scale to activeScale; scale means target scale | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
443787,2 | PinchHandler null target: remember accumulated scale between pinches | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
443909,4 | PinchHandler null target: remember accumulated scale between pinches | 6.4 | qt/qtdeclarative | Status: MERGED | +2 | 0 |
443912,4 | PinchHandler null target: remember accumulated scale between pinches | tqtc/lts-6.2 | qt/tqtc-qtdeclarative | Status: MERGED | +2 | 0 |