Results 1 to 3 of 3

Thread: QTableView: get the value of a removed column

  1. #1
    Join Date
    Aug 2009
    Posts
    92
    Thanks
    5
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QTableView: get the value of a removed column

    I use a QTableView with a QSqlTableModel.
    There is a typical "Id" table field that the user should not see, so I remove it's relative column.
    But if I want to execute a query like "DELETE FROM table WHERE Id = :id" I don't have the Id because it's column has been removed.

    Is there an easy and elegant solution for that ?

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: QTableView: get the value of a removed column

    I'm not using tableviews etc. much so I may be wrong, but shouldn't this
    Qt Code:
    1. tableView->setColumnHidden(x,true);
    2. // where x is the column number for "id" field
    To copy to clipboard, switch view to plain text mode 
    do the job ?
    Last edited by stampede; 25th October 2013 at 14:59. Reason: updated contents

  3. #3
    Join Date
    Aug 2009
    Posts
    92
    Thanks
    5
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QTableView: get the value of a removed column

    I've always used that but for some unknown reason I thought that setColumnHidden had been removed!
    Ok, thanks a lot.

Similar Threads

  1. How to get all column data of a QTableView
    By npascual in forum Qt Programming
    Replies: 1
    Last Post: 26th September 2012, 09:05
  2. Set an editable column for QTableView
    By SIFE in forum Qt Programming
    Replies: 5
    Last Post: 14th March 2012, 23:09
  3. QTableView with a column of images
    By elanari in forum Qt Programming
    Replies: 13
    Last Post: 7th February 2012, 12:25
  4. QTableView set column Decimals
    By ottoshmidt in forum Qt Programming
    Replies: 1
    Last Post: 20th December 2010, 05:00
  5. QTableView column trouble
    By nategoofs in forum Qt Programming
    Replies: 6
    Last Post: 27th October 2009, 20:14

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.