PDA

View Full Version : How to populate data from a selected row in a QtableView onto a separate dialog box



newtoQ_s
23rd September 2015, 09:23
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.

anda_skoa
23rd September 2015, 09:44
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,
_

newtoQ_s
23rd September 2015, 14:20
Hi thanks,

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