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