PDA

View Full Version : Need Advice on Good Widget for Defining Order of Items in a List



davethomaspilot
7th January 2013, 22:13
I'm pretty new to using the built-in Qt widgets.

I have a list of six names. I want the user to be able to pick four of the six, and define an order for those four.

There will be N sets of these lists. The lists are teams, with four team members active at a time. So the user picks a team with six players. Any previous choices need to be remembered, but the user can change which four on the team are active, and what order they're in.

One way I thought of is to have four comboboxes with the same six items for each. The user then picks a different name for each or the four comboboxes. I'd have to indicate somehow when the same name was in two comboboxes.

I can make that work, but maybe there are better ways? The "which 4 of the six" changes infrequently. The order of the "chosen 4" is likely to change frequently. The data I need from the widget is the "chosen 4" in the defined order.

I think a really convenient way would allow the order to be changed by dragging something to the correct place in the four positions, but that might be too complicated.

Thanks for any help!

wysota
7th January 2013, 22:52
Hmm... QListWidget or QTreeWidget, optionally with checkboxes?

boudie
8th January 2013, 08:33
Create one QListWidget, with six items.
Next to it, you place 2 buttons, MoveUp and MoveDown (with a nice icon...).

Select the name you want on top of the list and click MoveUp to get it there.
Select the next name etc. etc.

When done, click Done, or OK.
Read the first 4 or all 6 items.

This way you don`t have the trouble of indicating double items and copying between widgets.
It`s also easier to the eyes, because there are less widgets and you can concentrate on the items (names).

Santosh Reddy
8th January 2013, 10:28
I will suggest QTableWidget, with couple of custom QTableWidgetItems in the column cells, that would be nice (from user perspective).

davethomaspilot
8th January 2013, 21:08
I'm trying out QTableWidget for this, the column headers are the team members. Each row has split times for the team members.

Making the horizontal header "movable" seems to work nicely. But, I like the idea of having arrow icons to move the selected column left or right, since I'm not sure how well drag/drop will work on a tablet. Do I need to write the code to move the data to swap with the adjacent left or right column, or is there a "slicker" way?

Also, if I keep the movable headers, can I keep the first column fixed, but allow all others to be movable?

Thanks!