Help needed in Qtreeview sorting



  • Hi,
    I am working on a Qt UI application. I use a qtreeview to display the contents in the UI. I have enabled sorting by using setsortingEnabled(true) function. In my application i have a Qlist that also holds the contents of qtreeview (and few more details). The problem i am facing is when i click on the Qtreeview header only the qtreeview is sorted and the Qlist is unchanged. I want this Qlist to be sorted also. I was searching the the internet to see of there is a signal emitted during sort so that i can manually sort the qlist but couldnot find one.
    Please tell me if any signal is emitted during the sorting of qtreeview that i can use. also let me know if there is some other idea that i can explore on this.

    Thanks,
    Sathish


  • Lifetime Qt Champion

    Hi,

    I'm not sure I'm understanding correctly. Do you want to modify your underlying data when sorting your QTreeView ?



  • Hi,
    I have a "copy of" the treeview contents stored in a Qlist. when qtreeview is sorted, i want to sort the Qlist as well.
    each row in the treeview corresponds to a node in the Qlist,i am maintaining.
    each qlist node has more details of the row needed for backend processing. So when i click on the Qtreeview header for sorting, Is there any signal emitted that i can you to manually sort the Qlist?.
    Please let me know if you need more information.


  • Lifetime Qt Champion

    AFAIK, no there's not. You'll have to do it by hand. But still, I don't see why you need do such a double sorting. Sorting the view and the internal data just doubles the work and if you have other views on the same model then they will also get influenced by that.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.