Results 1 to 3 of 3

Thread: How to populate data from a selected row in a QtableView onto a separate dialog box

  1. #1
    Join Date
    Sep 2015
    Posts
    25
    Thanks
    5

    Default How to populate data from a selected row in a QtableView onto a separate dialog box

    Hi,

    I am wondering how one can fill lineedits of a different dialog box using data from a single row in a QtableView.
    Ex A table view row consists:- Frances 5704gvb@tyie.com
    I can see that one can access the individual column data using selectionmodel->currentindex;

    Is there anyway that one can access all of the elements on the row? I have set the selection mode to be such that the entire row must be highlighted.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,419
    Thanks
    37
    Thanked 1,546 Times in 1,496 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to populate data from a selected row in a QtableView onto a separate dialog b

    You can always ask the model for a different index, given row and column of your choosing.

    Also, since you have row selection enabled, the list returned by selectedIndexes() should contain all columns.

    One other option you can look at is QDataWidgetMapper. It can directly operate on a model and map column value into widgets.

    Cheers,
    _

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

    newtoQ_s (23rd September 2015)

  4. #3
    Join Date
    Sep 2015
    Posts
    25
    Thanks
    5

    Default Re: How to populate data from a selected row in a QtableView onto a separate dialog b

    Hi thanks,

    I was able to figure it out from the suggestion given by you.

Similar Threads

  1. Replies: 22
    Last Post: 24th September 2015, 08:00
  2. Replies: 3
    Last Post: 1st February 2011, 11:57
  3. How to populate Combobox in QTableView
    By ronak.vashi in forum Newbie
    Replies: 8
    Last Post: 4th December 2010, 17:09
  4. QTableView only showing data when row selected
    By Banjo in forum Qt Programming
    Replies: 2
    Last Post: 27th January 2009, 05:34
  5. Showing selected rows in a separate table
    By dnnc in forum Qt Programming
    Replies: 3
    Last Post: 21st June 2007, 16:35

Tags for this Thread

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.