[PyKDE] Failing to set the text of comboboxes
Jorge Godoy
godoy at ieee.org
Fri May 13 18:23:03 BST 2005
Hi!
I have some comboboxes with some items in it, I allow them to be edited and I
disallowed having duplicate items on them, so that if the text the user inputs
already exists then it is used by the program instead of having a new item.
It is all working perfectly, except that when I need to come back from the
database to the GUI it isn't accepting the 'setCurrentText()' command. In
fact, it accepts it, gives no error, but doesn't change the text in the
comboboxes.
My code is like this:
def dbExams_currentChanged(self, record):
code = record.value('code').toString()
relatnum = record.value('unidaderelatnum').toString()
relatden = record.value('unidaderelatden').toString()
equipnum = record.value('unidadeequipnum').toString()
equipden = record.value('unidadeequipden').toString()
self.cbCode.setCurrentText(code)
self.cbRelatNum.setCurrentText(relatnum)
self.cbRelatDen.setCurrentText(relatden)
self.cbEquipNum.setCurrentText(equipnum)
self.cbEquipDen.setCurrentText(equipden)
This is activated by a handler created with KDevDesigner. This piece of code
gets called, but doesn't change the text on the GUI and I get no errors at
all.
cbCode, cbRelatNum, cbRelatDen, etc. are comboboxes.
As an example, the code generated by pyuic for cbCode is:
self.cbCode = QComboBox(0,self.dbExames,"cbCode")
self.cbCode.setGeometry(QRect(120,0,330,23))
self.cbCode.setEditable(1)
self.cbCode.setAutoCompletion(1)
self.cbCode.setDuplicatesEnabled(0)
Should I be doing something else?
Is there any method to find the index position for some given text that I
could use to try showing the desired item?
Be seeing you,
--
Jorge Godoy <godoy at ieee.org>
More information about the PyQt
mailing list