Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Help needed in Qtreeview sorting
Forum Update on Monday, May 27th 2025

Help needed in Qtreeview sorting

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sathishm
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

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

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sathishm
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          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.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved