Results 1 to 3 of 3

Thread: Extract specific column data using row index - QTableView

  1. #1
    Join Date
    Aug 2010
    Posts
    30
    Thanks
    2

    Default Extract specific column data using row index - QTableView

    Hi,

    I want to be able to extract a specific column's data using a row index. For example, my table is populated using an SQL query, when a user selects an item from the table the whole row is highlighted. From this highlighted row, I want to extract the 2nd column row as a String value.

    I have the following code/slot for when the table is selected:
    Qt Code:
    1. void GUI::receviedIndex( const QModelIndex &index ){
    2.  
    3. QString temp = QString::number(index.row());
    4. QMessageBox::critical(0, QObject::tr("Testing"),temp);
    5. }
    To copy to clipboard, switch view to plain text mode 


    I've tried a couple of things without success. Can anyone suggest what classes/methods to look at in order to achieve this?

    Thanks

  2. #2
    Join Date
    May 2009
    Location
    USA
    Posts
    300
    Thanks
    82
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Extract specific column data using row index - QTableView

    Are you trying to get the row, the column, or the cell data? It's not clear to me.

  3. #3
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Extract specific column data using row index - QTableView


Similar Threads

  1. Replies: 1
    Last Post: 23rd January 2010, 22:04
  2. How can I extract raw data from a QPixmap?
    By ricardo in forum Qt Programming
    Replies: 3
    Last Post: 16th September 2009, 08:31
  3. extract data from sqlTablemodel
    By peace_comp in forum Qt Programming
    Replies: 1
    Last Post: 13th May 2008, 19:25
  4. Extract QStandardItemModel from QTableView
    By patrik08 in forum Qt Programming
    Replies: 1
    Last Post: 16th January 2008, 08:34
  5. How to get current row(column) index in the QTextTable?
    By denny.t in forum Qt Programming
    Replies: 3
    Last Post: 5th April 2006, 07:53

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.