I am subclassing QOpenGLWindow
(not QGLWidget
or QOpenGLWidget
) and calling
auto container = QWidget::createWindowContainer(my_opengl_window);
to place it in the layout of a parent QWidget
.
The window displays correctly and I can interact with it, but container
(and its parent widget) do not receive context menu events when I right-click within my_opengl_window
. I do get a context menu if I right-click on the slim margin between the window and its container.
void MyGLWindow::mousePressEvent (QMouseEvent * e)
{
qDebug (__PRETTY_FUNCTION__);
QOpenGLWindow::mousePressEvent (e);
}
The above shows me that my_opengl_window
is receiving mouse clicks. I have also tried e->ignore ()
but still the parent does not receive a context menu event.
Also, setCursor
and setToolTip
on the container widget have no effect. I suspect this may be related.
How can I get these mouse events to work on a QOpenGLWindow
container?