QtQuick Controls TreeView section
-
I am currently in the process of migrating from QTreeView Clas to QtQuick.Controls TreeView. In the original TreeView, I utilized the function
void QHeaderView::moveSection(int from, int to)
to move one of the columns to the first position (before the branch indicator). This column was used for row numbering and was displayed just before the branch indicator, unaffected by the tree's indentations. Now, I would like to achieve the same functionality in QtQuick.Controls TreeView. How can I do that?
In the documentation, there is a property called
section
but I'm unsure how to use it. It seems that it's used to section items row-wise rather than column-wise.Additionally, I can't utilize
rowDelegate
withstyleData.row
because it enumerates only visible rows (collapsed children are not counted).I am using Qt 5.12.2
-
@RandomName I am not sure about your specific question but would just like to note, in case you aren't already aware, that the
TreeView
in Qt 5.12 comes from the original Quick Controls library, which is deprecated in later Qt 5 releases and has been completely removed in Qt 6.There is a completely new
TreeView
in Qt 6 which is not a drop-in replacement for the old one. If you have any plans to upgrade to Qt 6 in the near future, it might be worth bringing those plans forward rather than having to do this work twice.