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. How to change column header titles when using one model with multiple table views
Forum Updated to NodeBB v4.3 + New Features

How to change column header titles when using one model with multiple table views

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 2.6k Views 1 Watching
  • 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.
  • D Offline
    D Offline
    devrim.erdem
    wrote on 4 Jan 2012, 09:20 last edited by
    #1

    Hi,

    I have a custom QAbstractItemModel based model and 4 QTableViews. Each table view uses the same model object.

    I would like to rename the horizontal header sections for each table differently. The models headerData() method unfortunately doesn't help, it would change the header titles for all of them at once.

    Any ideas?

    Thanks,

    1 Reply Last reply
    0
    • J Offline
      J Offline
      joonhwan
      wrote on 4 Jan 2012, 09:36 last edited by
      #2

      How about using your own QHeaderView derived class where you can handle its working differently ?
      You can set your header view using setHorizontalHeaderView/setVerticalHeaderView func.

      joonhwan at gmail dot com

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andre
        wrote on 4 Jan 2012, 10:10 last edited by
        #3

        I would use proxy models for each of your views. If you are on Qt 4.8, use [[doc:QIdentityProxyModel]] as the base for such proxies, if you are on Qt 4.7 or lower, use [[doc:QSortFilterProxyModel]] instead. In the proxy model, you simply reimplement the headerData() method to return whatever you need.

        1 Reply Last reply
        0

        1/3

        4 Jan 2012, 09:20

        • 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