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. Insert column in a QTableView
QtWS25 Last Chance

Insert column in a QTableView

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 2.5k 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.
  • R Offline
    R Offline
    Robey Mardon
    wrote on 6 May 2015, 15:57 last edited by Robey Mardon 5 Jun 2015, 18:23
    #1

    I'm using QSqlTableModel along with QTableView and the model returns the columns and rows, for example: name, brand, how to insert a custom column between them on QTableView? For example: name, model, brand.

    Let me explain it better... only name and brand is within the database, the model is a custom column that I need to add between them, and it doesn't need to be saved on the database, because the value can alter in runtime.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 6 May 2015, 20:53 last edited by
      #2

      Hi,

      You need a proxy model. Have a look a QAbstractProxyModel and QSortFilterProxyModel

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • D Offline
        D Offline
        DavidFaure
        wrote on 3 Feb 2016, 12:49 last edited by
        #3

        I wrote such a proxy (generic insertion of extra columns). You can use it, assuming LGPL code is OK:

        http://api.kde.org/frameworks-api/frameworks5-apidocs/kitemmodels/html/classKExtraColumnsProxyModel.html

        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