qtqmlqtquick2

How to disable dragging content that fits in ScrollView


The content of a QML ScrollView can be dragged using the mouse or touch gestures. The same is true for the content of ListViews, at least in the example I have. And it is even possible to do so when the content fits into the ScrollView and no scrollbars are displayed.

In this case, after releasing the mouse button, the content item moves back to its original place. Is there any way to disable this?


Solution

  • You are looking for the property boundsBehavior which ScrollView inherits from Flickable. Setting it to Flickable.StopAtBounds should do the trick. See also the property interactive.