How to call function after window is shown?

前端 未结 9 1214
余生分开走
余生分开走 2020-12-05 06:21

Using Qt I create a QMainWindow and want to call a function AFTER the windows is shown. When I call the function in the constructor the fun

9条回答
  •  醉酒成梦
    2020-12-05 07:24

    If you want to do something while the widget is made visible, you can override QWidget::showEvent like this:

    class YourWidget : public QWidget { ...
    
    void YourWidget::showEvent( QShowEvent* event ) {
        QWidget::showEvent( event );
        //your code here
    } 
    

提交回复
热议问题