Search code examples
qmlqtquick2qtquickcontrols

How to scroll to certain row in QML TreeView


In TreeView, selecting a row by clicking it. But I want to focus the row in TreeView by indicating the row QModelIndex and roleName.

I found similar function in ListView:

positionViewAtIndex(int index, PositionMode mode)

How to do this in TreeView?


Solution

  • Try to use hidden variable __listView.

    __listView.positionViewAtIndex(row, mode)