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. QSqlRelationalTableModel and QTableView::setColumnHidden
Forum Updated to NodeBB v4.3 + New Features

QSqlRelationalTableModel and QTableView::setColumnHidden

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

    Hello :)

    I am using QSqlRelationalTableView to serve as a mediator between two tables and my QTableView.

    So far, it's working well. The tables are correctly relationed and you see what must be seen :)

    But now I want to hide the index and another column that are of no use for the final user. So I tried:

    [code]
    ui->tableView_cascosYAccesorios->setColumnHidden(myBudget->models.cases_and_accesories->fieldIndex("id"), true); ui->tableView_cascosYAccesorios->setColumnHidden(myBudget->models.cases_and_accesories->fieldIndex("presupuesto"), true);
    [/code]

    I have also tried writing the column number directly (0 and 1), but that doesn't change anything. The columns still appear.

    I wonder if the order in which the models are assigned to the views and the setColumnHidden might matter or not?

    Thanks for any pointer. If you need code just ask, I just don't know what could be relevant, since, aside from setColumnHidden not working, everything else works as it should...

    1 Reply Last reply
    0
    • I Offline
      I Offline
      i92guboj
      wrote on last edited by
      #2

      I ended up ditching the relational tables altogether, and using my own custom delegate instead.

      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