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

Jorge Godoy godoy at ieee.org
Mon May 16 19:38:38 BST 2005


Torsten Marek <shlomme at gmx.net> writes:

> Hi Jorge,

Hi Torsten.

> 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?

I'll try something like that.  I should have done that this weekend, but I had
to leave for a while or I'd get crazy with so many things to do...  :-)  It
was a nice weekend.  Hot for mid-autumn. 

Anyway, if what you suggested below doesn't work, I'll do that.  But I haven't
done anything too complicated.  What I've done is:

        - connect to the database
        - retrieve the information I want to show
        - populate the combobox, using a loop ('while query.next(): ...')
        - trap the currentChanged signal from the dataBrowser and selecting
          trying to set the item on the combobox to the correct value

If I print debug messages they show the correct value, but the item doesn't
change on screen.

> Maybe you should first call insertItem(..) and then setCurrentItem(...)?

I haven't tried that because the items already exist there.  They were
retrieved from a database and populated the comboboxes when it was
instantiated.  I have disallowed inserting duplicate items, so it might
work...  I'll give it a try right now.  (time passes)  It didn't work.  I'll
try coming up with a simple example in one file only.  I'll be posting it in a
few minutes.


Thanks for your help!
-- 
Jorge Godoy      <godoy at ieee.org>




More information about the PyQt mailing list