How to disable scrolling in a QML ScrollView (or TextArea)

时间:2016-03-04 18:21:19

标签: qt textarea qml

I want to use a QML TextArea on a mobile device, where the user cannot scroll by swiping through the contents. Instead I want the widget to grow with the content (which I can do by utilizing contentHeight).

But I am unable to disable the scrolling behavior. TextArea has this scrolling behavior because it inherits from ScrollView.

1 个答案:

答案 0 :(得分:2)

您可以使用ScrollView的属性flickableItem来更改或禁用滚动行为。在你的情况下,我使用:

TextArea {
    flickableItem.interactive: false 
}

如果您想要做其他事情,请查看QML的Flickable,您应该能够像使用其他任何Flickable一样使用其所有属性。