Qt 6.12 LTS is out! See what's new in the release
blog
Adjust translation speed of QML DragHandler
-
My question is about using a QML DragHandler to move a QML Item. I have successfully implemented position through dragging (when holding the Ctrl modifier) like so:
DragHandler { dragThreshold: 0 acceptedModifiers: Qt.ControlModifier }Now I would like to add another handler that allows me to precisely position the element. Other software does this throught the use of the shift modifier. So what I want to do is move the element not by the pixel amount that the mouse moves, but an amount smaller than that. Ideally I would want to do something like this:
DragHandler { dragThreshold: 0 acceptedModifiers: Qt.ShiftModifier onActiveTranslationChanged: { activeTranslation *= 0.5; } }Unfortunatelly
activeTranslationis read-only and I don't see any other property I could use and I can't think of any other way to do it... Does anybody have an idea how to acchive this?Thank you very much in advance!