Add a dropdown menu to QListWidgetItem
I'm having some problems adding a dropdown menu to my dynamically generated QListWidgetItem.
I subclass QListWidgetItem to my custom entry and generate my content in the subclass and finally add it to the QListWidget.
Now i want to add a dropdown menu to every QListWidgetItem to delete the entry or modify it!
I did some other gui programming (swing,gtk+) but it seems to be different to in qt?
Can somebody help me?
Re: Add a dropdown menu to QListWidgetItem
What I probably would do, but this is just of the top of my head and without further checking:
If the items in the list all have the same context menu:
Create a slot that listens to the customContextMenuRequested signal of the widget.
Get the item at the given point, display the menu. Use either a signal mapper or clean up the connections before making new ones.
If the items can all have different actions, I would let each item handle its own actions.
Again from a slot connected to the customContextMenuRequested signal, create a new context menu based on the actions of the item at the given point.
Re: Add a dropdown menu to QListWidgetItem
QTableWidget is probably the class your are looking for.