Results 1 to 2 of 2

Thread: getting data from tableView

  1. #1
    Join Date
    Oct 2007
    Posts
    16
    Thanks
    3
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default getting data from tableView

    I want help on getting data from tableView with QSqlQueryModel,

    void MyQtApp::selectionChanged(const QModelIndex &index1,const QModelIndex &index2)
    {
    qDebug("Row:%i Data:%i\n",index1.row(), index1.data(0).toInt() );
    }

    I get here the value of selected cell of selection row. I want get first column data of selected row.

  2. #2
    Join Date
    Oct 2007
    Location
    Munich, Bavaria
    Posts
    144
    Thanks
    1
    Thanked 19 Times in 19 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: getting data from tableView

    Use this index:
    QModelIndex new_idx = index1.model()->index(index1.row(), 0);

  3. The following user says thank you to DeepDiver for this useful post:

    mkarakaplan (7th November 2007)

Similar Threads

  1. Replies: 4
    Last Post: 19th October 2007, 20:47
  2. Data model
    By steg90 in forum Qt Programming
    Replies: 3
    Last Post: 17th September 2007, 13:14
  3. My derived TableView - how to get data mouse is over
    By steg90 in forum Qt Programming
    Replies: 3
    Last Post: 17th May 2007, 10:09
  4. speed of setdata - lots of items in treeview
    By Big Duck in forum Qt Programming
    Replies: 4
    Last Post: 6th July 2006, 13:53
  5. Replies: 16
    Last Post: 7th March 2006, 16:57

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.