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

QTableView sorting and headers issue

Scheduled Pinned Locked Moved Solved General and Desktop
qtableviewsortingheader
2 Posts 1 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.
  • M Offline
    M Offline
    mjsurette
    wrote on 11 Dec 2015, 19:25 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 15 Dec 2015, 15:31 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

      2/2

      15 Dec 2015, 15:31

      • Login

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