PDA

View Full Version : How to make QListWidget items editable?



sax94
1st March 2012, 20:57
hello
I wanted to know 2 things:
1) wich is the best way to make QListWidget items editable because I have no idea of where I should start doing it.
2) how can i open a menu when I click with the right click of the mouse on a QListWWidget, even here I have no clou of where to start
sorry if the question are too vague but I can't find anything to help me.
thanks for the help

ChrisW67
1st March 2012, 21:47
1) wich is the best way to make QListWidget items editable because I have no idea of where I should start doing it.

There is no "best" way, just any way that meets your requirements. QListWidgetItem::setFlags()


2) how can i open a menu when I click with the right click of the mouse on a QListWWidget, even here I have no clou of where to start

A combination of QWidget::setContextMenuPolicy() on the list widget (an item is not a widget) and some code to determine which item was under the cursor (QListWidget::itemAt()) when the menu was summoned seems like a good place to start. Text text edit demo contains a custom context menu.