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. Disable sorting in QTreeView
Forum Updated to NodeBB v4.3 + New Features

Disable sorting in QTreeView

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 1.2k 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.
  • I Offline
    I Offline
    ivanicy
    wrote on 16 Jul 2018, 14:05 last edited by
    #1

    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: 7

    When 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: 9

    The rows sorted automatically.

    How can I disable it?

    Thank you very much!!!

    1 Reply Last reply
    0
    • E Offline
      E Offline
      ed-wright
      wrote on 16 Jul 2018, 14:09 last edited by ed-wright
      #2

      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

      1 Reply Last reply
      0
      • V Offline
        V Offline
        VRonin
        wrote on 16 Jul 2018, 17:15 last edited by
        #3

        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?

        "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
        ~Napoleon Bonaparte

        On a crusade to banish setIndexWidget() from the holy land of Qt

        1 Reply Last reply
        1

        1/3

        16 Jul 2018, 14:05

        • Login

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