PDA

View Full Version : QTableView Mouse/Keyboard Events in QGraphicsProxyWidget



Goug
15th November 2011, 02:40
Hi,

I've created a QTableView and populated it with a custom model. I need to display the table in a scene, so I've created a QGraphicsProxyWidget and set the QTableView as its widget. It displays reasonably fine...much fine-tuning to do, but the data is there, and my vertical scroll bar appears as intended.

The problem I'm having is that the QTableView isn't getting any mouse or keyboard events. I can't grab the scroll bar, click on a column heading, select a cell, etc. Using page up/page down to scroll doesn't do anything either. I tried setting the ItemIsFocusable flag, but that didn't appear to make any difference.

I experimented with a QTextEdit widget many months ago in a QGraphicsProxyWidget, and I don't recall any problems entering text into it without doing anything special, so I'm at a bit of a loss here.

Suggestions?

Thanks,
Doug

Goug
16th November 2011, 00:00
I figured it out. At some point between my early prototype first learning Qt and my current work, I'd decided that all of my scene items needed to be children of a QGraphicsItemGroup. I've since realized that's not true and unworkable for some of the things I need to do, but I haven't gone back and reworked my derived classes to change the parent item to something else. The QGraphicsItemGroup is preventing the child items from receiving events, which is something I knew but had forgotten about. It's time to fix that up.

Doug