PDA

View Full Version : How to use list of items?



Squall
18th March 2012, 23:00
Hello, I am new to Qt.
I want to use a list (maybe QListWidget) that allows the user to add, remove, rename, copy and reorder (up or down) items, but I do not know how to implement it.
The default QListWidget has no button or context menu, it does not allow the user to add, remove and rename items.

Will I have to create a button for each operation?
Do the rename and add operation require a dialog box that allows the user to write the item name? It would be more user friendly to write the name of an item directly into the list, without a dialog box.

Thanks.

ChrisW67
19th March 2012, 00:22
Will I have to create a button for each operation?
Yes (a button, menu option, something), except rename which the user can do simply by editing the entry unless you have some other reason to separate the process. Add can just inert a new blank row and allow the user to edit it. Reordering and delete can be done by drag and drop, but you should walk before you try to run.

Do the rename and add operation require a dialog box that allows the user to write the item name? It would be more user friendly to write the name of an item directly into the list, without a dialog box.
No they don't, and yes it would. Mark a QListWidgetItem editable using setFlags() with Qt::ItemIsEditable