[PyKDE] Failing to set the text of comboboxes
Torsten Marek
shlomme at gmx.net
Mon May 16 19:25:17 BST 2005
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Jorge Godoy schrieb:
> 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?
>
Hi Jorge,
if I try to use setCurrentText in a simple example, I do not observe any
problems, the text just gets set.
Have you been able to track down the problem?
And if not, can you produce a minimal program that displays your problem and
send it in along with the versions of Python, Qt, sip and PyQt?
Maybe you should first call insertItem(..) and then setCurrentItem(...)?
greetings
Torsten
- --
Torsten Marek <shlomme at gmx.net>
ID: A244C858 -- FP: 1902 0002 5DFC 856B F146 894C 7CC5 451E A244 C858
Keyserver: subkeys.pgp.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFCiOWNfMVFHqJEyFgRAiJUAJ4/JHJT/RbsjTyPOnw4a9iJFtU0bwCfYm/8
d5dYX5wRQ0Cst2H1YMdXKj8=
=m0SS
-----END PGP SIGNATURE-----
More information about the PyQt
mailing list