On 30.01.10 22:44:24, Claudio Felix wrote: > > > > Looking at the source code in Qt, I think the reason for this is because > > there's no connection between the currentIndex() in the itemview and the > > one in its selectionModel. In particular the currentChanged() slot in > > the itemview doesn't update its internal currentIndex. I think thats a > > bug in Qt. > > > > So you'll have to ignore the view here and work with the row from the > > combobox to generate a model index. This should work: > > > > def getItemID(self: > > self.comboBox.setCurrentIndex(0) > > idx = self.model.index( self.comboBox.currentIndex(), > > self.model.fieldIndex("ITEM_ID"), QModelIndex() ) > > return self.model.data(idx).toInt()[0] > > > > Andreas > > It worked fine that way. Since these DB records won't change anyway, I > think indexing the ITEM_ID field by the combo box item index will do > the job in the long run for this particular project. About this > potential bug of the lack of connection between the currentIndex in > the itemview and the one in the selectionModel, should we report this > to Phil or maybe open a bug report for QT? I'm not familiar with QT's > source code, but if that is really a bug (and it looks like it is) it > would be nice to get it fixed, huh?
File it with Qt as bug, for getting their attention it should be enough if you can provide a small example demonstrating the problem (IIRC they prefer C++). Andreas -- You will be run over by a bus. _______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt