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. QTableView sorting and headers issue
QtWS25 Last Chance

QTableView sorting and headers issue

Scheduled Pinned Locked Moved Solved General and Desktop
qtableviewsortingheader
2 Posts 1 Posters 1.1k 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.
  • M Offline
    M Offline
    mjsurette
    wrote on last edited by
    #1

    I have subclassed QSortFilterProxyModel and reimplemented lessThan in order to sort by multiple columns.

    I have a problem in that in order for it to work I have to make call setSortingEnabled() on my QTableView. This makes clicking my headers sort by that column and disables selecting columns.

    Is there a way to make sorting work and have selectable headers?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mjsurette
      wrote on last edited by
      #2

      The solution was to explicitly call sort after the call to invalidate with setSortingEnabled set to false. Both invalidate and sort were necessary

      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