PyQt - Question on QListWidget's selectedItems Method

K

Kelie

Hello,

This method returns selected items by the order of user's picking,
instead of the original order of these items. For example, if a
ListWidget stores a list of ['A', 'B', 'C', 'D'] and when user is
prompted to make a selection, if he picks 'D' first, then 'B', the
returned ListWidget items would be 'D' first, then 'B', instead of 'B'
first, then 'D'. This seems unusual to me. Would users normally care
about the order of these items being picked? This selectedItems method
does not seem to have an optional argument that allows returned items
to be in their original order when added to the ListWidget. What did I
miss?

Thank you!
 
K

Kelie

Another question I have about QListWidget is when user manually
selects and deselects a QListWidgetItem, the background color switches
between blue and white. But when an item is programmingly selected
with setItemSelected method, the background color is some kind of
light gray instead of blue. Why is there such a difference and how do
I programmingly set the QListWidgetItem background color to blue?

Thank you!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,152
Latest member
LorettaGur
Top