Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

how to click the Header to sort by this column , on QTreeWidget?



  • how to click the Header to sort by this column , on QTreeWidget?

    1. i find that the click on the Header , no reaction.
    2. i want to show an up/down arrow on 1 column of the header. how?
    3. is there existed method to sort the QTreeWidget by 1 column?


  • use setSortingEnabled() on the QTreeView (or QTreeWidget, which is a derived class of QTreeView)



  • is there any existed sort method i can use ?



  • when i setSortingEnabled(true), i can click the header, and it will sort ascending or descengding, but it's just sort by the name, and do not care anything else.
    how can i sort by myself when i click the header?
    i want to sort by the name on basis of the item type(eg, dir, and files).
    thank you


Log in to reply