I am trying to get click events (ultimately left, right and double click) to "pass through" an editor widget to the underlying QListView so that selections can happen. Figured Event Filters were probably the way to go, but I am a little confused as to where the eventFilter(object,event) function and the installEventFilter() call need to go in order for that to happen.
In my case, I am using a custom delegate class to draw my data in my QListView and am using an editor to update the model based upon cursor positions. I want this to just be constantly active, so I made my QListView active the editor upon entering an item.
dataView=QListView(self)
dataView.setGeometry(self.rect())
dataView.setViewMode(1)
dataView.setMovement(0)
dataView.setSelectionMode(QAbstractItemView.ExtendedSelection)
dataView.setMouseTracking(True)
dataView.entered.connect(dataView.edit)
delegate=CustomDelegate(self)
dataModel=QStandardItemModel(self)
dataView.setModel(dataModel)
dataView.setItemDelegate(delegate)
The downside to this is that while your mouse is on an item, it is now covered by the editor widget which I believe is collecting mouse click data thus blocking clicks from selecting the items within the QListView.
In my delegate, I have it create the editor as so and connect signals to update my data (frames) in my model to change the way the delegate displays and to close the editor
def createEditor(self,parent,option,index):
editor=TestEditor(parent)
editor.editingFinished.connect(self.deleteEditor)
editor.updateFrame.connect(self.updateFrames)
return editor
Where would I create my event filter? In my main where I am generating my QListView? Within a custom QListView? Within my Delegate? Or within my editor widget? And then where would I call the installEventFilter()?