2 Attachment(s)
Interaction with a widget that is rendered to display data in a model
Hi!
I've got a custom model and a custom delegate. The delegate (for Qt.DisplayRole) instantiates a widget with a label and a button. See the attached screenshot for visualization: Attachment 5091
If the widget is shown f.ex. in a listview I cannot press the button. Is there a way that I can interact with a control on the widget if it is not shown in edit-mode?
The other attachment is a show case for the issue in PyQt code: Attachment 5092
Thanks in advance!
Re: Interaction with a widget that is rendered to display data in a model
Solved, thanks. The trick is to use QAbstractItemView.openPersistentEditor(index) as render just gives the pixmaps of the widget without functionality. So one has to implement the createEditor and an empty setModelData method in the delegate.
However, if one does that for many items it gets slow. For me it doesn't matter since I anyway just wanted the button to show up if the mouse hovers over it, so its just one persistent editor