sorting problem...same contents but 2 view (QListWidget and QTreeWidget)
sorting problem...same contents but 2 view (QListWidget and QTreeWidget).
i use QListWidget and QTreeWidget in a QStackedWidget to represent same Contents, because i want to preview in multi-column ListMode from QTreeWidget, IconMode from QListWidget...
right now, i can click on the Header of the QTreeWidget to sort the items, but after sorting in QTreeWidget, when i switch to IconMode which is in QListWidget, i want the items order is the same with the sorted items order in QTreeWidget...
how can i do this ?
can i have a try like this? because 1. the user are only allowed to sort in the QTreeWidget, by click on the multi-column Header. 2. both the items in QTreeWidget and QListWidget have a same data which is used setData() to the Item.
- click the Header in the QTreeWidget, sort it.
- get the items in the QTreeWidget(because it's designed that there only 1 level children)
- based sorted QTreeWidget's items Data, sort(or clear and re-create) the items in the QListWidget.