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. One ItemModel with two different Item views which have different coloumn count
Forum Updated to NodeBB v4.3 + New Features

One ItemModel with two different Item views which have different coloumn count

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 137 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.
  • DonCoderD Offline
    DonCoderD Offline
    DonCoder
    wrote on last edited by DonCoder
    #1

    I have designed a QAbstractItemModel with coloumn count N.
    But there are two different views say ViewA and ViewB are using this model.
    ViewA and ViewB are QTableViews and Model is QAbstractItemModel
    ViewA should display M columns (where M < N). and ViewB should display N columns.

    So how can i handle this. What are the apis i am supposed to handle at the levels of views. Mostly i do not wanted to disturb my Model class, this should be generic. Any Suggestions plz.

    1 Reply Last reply
    0
    • Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hide the columns in the second view.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      2
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi
        https://doc.qt.io/qt-5/qtableview.html#setColumnHidden

        1 Reply Last reply
        1

        • Login

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