PDA

View Full Version : mousePressEvent with QColumnView



BreakBad
12th August 2013, 16:16
I am noticing that QColumnView::mousePressEvent is never called after setting it's model. I'm assuming QColumnView creates child widgets for each column which prevent the parent (QColumnView) from receiving the events.

The problem I'm facing is after overwriting QColumnView::contextMenuEvent, I noticed if the user left clicks an item in column 2, then right clicks an item in column 1, it displays the contextMenu for the selected index in column 2. Therefor I overwrote QColumnView::mousePressEvent in hopes to allow right click to select the correct index/item before creating a contextMenu and ran into this problem.

Perhaps there is a better way to address this issue or someone could point me to the documentation that explains how QColumnView propagates itself.

Thanks for reading.

Ginsengelf
13th August 2013, 08:29
Hi, I also had some problems with events and item view widgets and found that the QWidget returned by viewport() seems to be the one that handles events, not the item view widget itself.

Ginsengelf

BreakBad
13th August 2013, 19:43
Thanks for that tip, that allowed me to make progress. I installed an event filter on the view and printed out all of the event types. However, I see no mouseEvents other than perhaps the ContextMenu event type. I went as far as to subclass my own viewport widget and overwrite the event method and mousePressEvent method with similar results. There is another player, perhaps the scrollarea? This is a wacky widget.