Disable sorting in QTreeView
-
wrote on 16 Jul 2018, 14:05 last edited by
Hello!!
I am working with QTreeView and I have a little issue.
I show different configurations in a QTreeView so, for example, I insert 3 rows with this ID's and order:
row 0 --> id: 9
row 1 --> id: 4
row 2 --> id: 7When I change the current index of a QComboBox, I load its information in the tableview and, when I reload this data again, the rows have this order:
row 0 --> id: 4
row 1 --> id: 7
row 2 --> id: 9The rows sorted automatically.
How can I disable it?
Thank you very much!!!
-
wrote on 16 Jul 2018, 14:09 last edited by ed-wright
Hi ivanicy,
When you change the index of the QComboBox do you use the setSortingEnabled() function that is part of QTreeView and if so do you set it to true?
Also could you provide screenshots of the before and after, i am quite new to this so a visual aid might help get to the root cause of this.
Thanks
-
wrote on 16 Jul 2018, 17:15 last edited by
The answer is add a
QSortFilterProxyModel
in-between. the question is where.@ivanicy said in Disable sorting in QTreeView:
When I change the current index of a QComboBox, I load its information in the tableview and, when I reload this data again
What does this mean exactly?
1/3