Results 1 to 11 of 11

Thread: QTableView : accessing the data

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2006
    Posts
    18
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    11
    Thanked 1 Time in 1 Post

    Default Re: QTableView : accessing the data

    Hi wysota,

    I've got it.
    For me, your :"// for generic models:" is better, for accessing the ID of the person.

    Still the code is not optimized, it is working. ;)

    It is inside the person.cpp file.

    void Person::on_OkButton_clicked()
    {
    qWarning( "on_OkButton_clicked : begin" );

    QAbstractItemModel *aim = PersonTableView->model();
    QModelIndex mi = PersonTableView->currentIndex();
    qDebug() << "Person::on_OkButton_clicked() : mi.row()=" << mi.row() ;
    int i = aim->data(mi.sibling(mi.row(), 0)).toInt();
    qDebug() << "Person::on_OkButton_clicked() : i=" << i ;

    PersonIdSet(aim->data(mi.sibling(mi.row(), 0)).toInt());
    PersonDetail *mw = new PersonDetail;
    mw->show();

    qWarning( "on_OkButton_clicked : end" );
    }

    So on the PersonDetail, I can manage only one record.

    Once again, thank you very much.

    Regards.
    Last edited by marvaneke; 24th July 2006 at 22:37. Reason: This post is closed.

  2. #2
    Join Date
    Mar 2012
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QTableView : accessing the data

    After trying all the possibles on this page, settled for a QSqlQuery to retrieve the data.
    Using QSqlQueryModel that has been sub classed.

Similar Threads

  1. speed of setdata - lots of items in treeview
    By Big Duck in forum Qt Programming
    Replies: 4
    Last Post: 6th July 2006, 12:53
  2. QTableView versus QTableWidget
    By jcr in forum Qt Programming
    Replies: 2
    Last Post: 24th May 2006, 19:51
  3. Multi-line messages in QTableView
    By Conel in forum Qt Programming
    Replies: 6
    Last Post: 13th April 2006, 13:49
  4. How to convert binary data to hexadecimal data
    By yellowmat in forum Newbie
    Replies: 4
    Last Post: 8th March 2006, 16:17
  5. Replies: 16
    Last Post: 7th March 2006, 15: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
  •  
Qt is a trademark of The Qt Company.