[PyQt] QComboBox: display text but pass on Unique Id (MySql)

Cristobal Infante cgcris at gmail.com
Fri Nov 4 13:51:45 GMT 2011


Hi guys,

My first post in this list, a big hello to everyone :D

I am just starting with Pyqt but have enough experience with python.

I am connecting a Mysql Databse nicely, being able to retrieve the complete
table and
get it as a model. I've then been able to display in a combobox a "Name"
column
just by using 'setcolumn(1).

Until here is all good, but is passing the Id from that record that's
proven hard to crack for me.
I've been looking around in the net, but havent been able to find an
example using a database.
So display "Jane" put pass on the unique ID of that record.

I have an 'activated' function that is being executed everytime the combo
changes, but at the moment it's only retrieving
info from that column that's displayed in the combobox.

Any help or hint would be really usefull.

Thanks again,
Cristobal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20111104/959856e3/attachment.html>


More information about the PyQt mailing list