PDA

View Full Version : Handling Mouse Events of a parent widget



dvmorris
28th March 2007, 18:36
I have a QTabWidget that contains four custom opengl widgets as child tabs, and the OpenGL widget class has mouse event handlers for rotating, panning, and zooming the 3d view.

Those handlers are only used when the ALT key is pressed, but when the ALT key is not pressed, I want to send those mouse events to the parent widget, the QTabWidget. Is there a way to do that? The QTabWidget will then handle events where the user wants to select something in the viewport and interact with the model inside the viewport rather than just rotate or pan the view.

I tried calling parentWidget()->mouseMoveEvent(event) for example, and it says that function is protected. The QTabWidget has mouse Event handlers defined as public functions, so I'm not sure what is wrong.

I hope that makes sense, and I appreciate any help that can be given. Thanks,
Dave

jpn
28th March 2007, 18:40
Try ignoring the event (http://doc.trolltech.com/4.2/qevent.html#ignore).

dvmorris
28th March 2007, 18:44
ok i apologize. I'm an idiot. I just found this right after posting this question:

http://labs.trolltech.com/blogs/2006/05/27/mouse-event-propagation/