I havent found the soultion for this yet, it's driving me a bit mad<div><br></div><div>can somebody please answer me this "simple" question:</div><div><br></div><div>How do you retrieve a single value from a model if you know the index? </div>
<div><br></div><div>Thanks, Cris</div><div><br><br><div class="gmail_quote">On 8 November 2011 22:38, David Boddie <span dir="ltr"><<a href="mailto:david@boddie.org.uk" target="_blank">david@boddie.org.uk</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>On Fri, 4 Nov 2011 13:51:45 +0000, Cristobal Infante wrote:<br>
<br>
> My first post in this list, a big hello to everyone :D<br>
<br>
</div>Welcome!<br>
<div><br>
> I am just starting with Pyqt but have enough experience with python.<br>
><br>
> I am connecting a Mysql Databse nicely, being able to retrieve the complete<br>
> table and<br>
> get it as a model. I've then been able to display in a combobox a "Name"<br>
> column<br>
> just by using 'setcolumn(1).<br>
<br>
</div>OK. So far so good.<br>
<div><br>
> Until here is all good, but is passing the Id from that record that's<br>
> proven hard to crack for me.<br>
> I've been looking around in the net, but havent been able to find an<br>
> example using a database.<br>
> So display "Jane" put pass on the unique ID of that record.<br>
<br>
</div>Just an idea: is the record() method of the model what you want? The model<br>
should inherit this from QSqlQueryModel.record().<br>
<div><br>
> I have an 'activated' function that is being executed everytime the combo<br>
> changes, but at the moment it's only retrieving<br>
> info from that column that's displayed in the combobox.<br>
<br>
</div>You can get the corresponding row of the item displayed in the combo box<br>
by calling the QComboBox.currentIndex() method. This is effectively the<br>
same as the row in the model, anyway. Then pass it to the model's record()<br>
method and see what you get.<br>
<br>
Does that work?<br>
<span><font color="#888888"><br>
David<br>
</font></span><div><div>_______________________________________________<br>
PyQt mailing list    <a href="mailto:PyQt@riverbankcomputing.com" target="_blank">PyQt@riverbankcomputing.com</a><br>
<a href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt" target="_blank">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br>
</div></div></blockquote></div><br>
</div>