Is it alternative of windowClosed event for openglwindow?



  • How to catch the event of X button pressed on opengl rendering window closed?
    void windowClosed(CloseEvent * ce) Does not appear to work for opengl window.



  • Hi,
    I would think the x-button is part of a widget not of a (opengl)window. The usual way is to override the widget's closeEvent. But if you generate the widget from the (opengl)window you cannot do it directly. You can probably include the widget in the layout of another widget where you can then override the closeEvent.
    -Michael.


  • Lifetime Qt Champion

    Hi,

    To add to @m-sue, what do you need to do when your QOpenGLWindow closes ?



  • Hi,
    To change bool variable in other class depending if rendering or closed window.
    The opengl window condition could be checked in some timed loop also, it is not important to capture the exact moment.


  • Lifetime Qt Champion

    Then why not use the visible property for that ?



  • You could also create a SIGNAL and emit it that says your custom window has closed. If you are do not know the pointer to the QOpenGLWindow to connect to it, you could route through a parent class by creating the same signal, connecting the QOpenGLWindow to the parent signal, then connecting the obtaining slot to the parent window.

    Seems like a round about way, but signals and slots are useful in many ways. It is like a router pattern for signals and slots.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.