Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

MDI sub window's event handling?



  • I have a widget inherited from QGLWidget which is added to MDI area with addSubWindow().

    I implemented my widget's keyPressEvent(), making it output a line of text every time it is called.
    But it seems not working -- I guess the key press event is captured by QMdiSubWindow, but not sure.



  • Well, for you desperate guys who found this page with google...

    Just:

    1. write a class P which inherites QMdiSubWindow;
    2. reimplement QMdiSubWindow::*Event();
    3. use QMdiSubWindow::setWidget(QWidget *);
    4. call QMdiArea::addSubWindow(p). [here p is the instance of your class P]

Log in to reply