[PyKDE] Re: Failing to set the text of comboboxes

Jorge Godoy godoy at ieee.org
Fri May 13 19:01:05 BST 2005


Jorge Godoy <godoy at ieee.org> writes:

(...)

> 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()
(...)
>         self.cbCode.setCurrentText(code)

I also tried this variation without success:

        code = registro.value('code').toString()
        for i in xrange(self.cbCode.count()):
            if self.cbCode.text(i) == code:
                self.cbCode.setCurrentItem(i)
                break

> Is there any method to find the index position for some given text that I
> could use to try showing the desired item?

The attempt above was a way to achieve that...  I don't know if it is the best
or not, but it didn't work.

-- 
Jorge Godoy      <godoy at ieee.org>




More information about the PyQt mailing list