On Tuesday 10 May 2005 13:15, Jorge Godoy wrote: > Hi, > > > I'm using some comboboxes in an application and I'd like to know if there's > some way to use both information it contains simultaneously: > > - text > - index > > I'd like to show the text and to make the index contain a reference to > other stuff. It works great if my data has no holes in it, but I get the > following message if I try to insert a record with index 0 and a second > record with index 3: > > QComboBox::insertItem: (cbCodigo) Index 3 out of range > > I used to work that way with wxPython and I'd really like to maintain some > logic with pyQt. > > Is it possible or not? Docs doesn't mention anything at all about that.
In the case of QComboBox, "index" refers to an item's position in the combo box's list of items. The list of items is a list of strings. There are a number of ways to do what you want, but they would be things like maintaining a separate data structure which maps items and (your) index values, or subclassing QComboBox to do that for you automatically. The implementation would depend a lot on your application. Jim _______________________________________________ PyKDE mailing list [email protected] http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
