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. Merging two columns using QSqlTableModel/QTableView
Forum Updated to NodeBB v4.3 + New Features

Merging two columns using QSqlTableModel/QTableView

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 3.2k 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.
  • Q Offline
    Q Offline
    qtest
    wrote on last edited by
    #1

    I'm using a class derived from QSqlTableModel with an associated QTableView. I would like to merge two columns in the model so thay are displayed in a single column in the view.

    As an example, assume my database contains records on cars. In this database the cars' licence plate numbers are (for some reason beyond my control) stored so that the letters are separate from the numbers, e.g. the licence number ABC-123 is stored so that ABC goes into one column and 123 in another. However, in the view I would like to display the number as ABC-123 in a single column.

    What would be the best way to achieve this?

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      Create a proxy model that does that.

      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