[PyQt] QComboBox: display an item different from the chosen one in the QListView

TP paratribulations at free.fr
Wed Mar 18 17:51:25 GMT 2009


Hi everybody,

I want to specialize a QComboBox. I take a dummy example: if there are the
following choices in the QListView provided by the QComboBox:

"toto"
"titi"
"tutu"

I want that if the user chooses "toto", to display "toto has been chosen" in
the QComboBox.
If the user chooses "titi", then I want to display "titi has been chosen".

How to do that?

I have defined my own model, but it seems impossible to do this from the
model, it seems that this specialization of QComboBox has to be done in the
view. Anyway, it seems cleaner to do that in the view, because the
underlying data is for example "toto", not "toto has been chosen".
So I have tried to play with a lot of methods provided by QComboBox, without
success (for example, "currentText", "setItemText", etc.).

Thanks in advance

Julien

-- 
python -c "print ''.join([chr(154 - ord(c)) for c in '*9(9&(18%.\
9&1+,\'Z4(55l4('])"

"When a distinguished but elderly scientist states that something is
possible, he is almost certainly right. When he states that something is
impossible, he is very probably wrong." (first law of AC Clarke)



More information about the PyQt mailing list