Unexpected behaviour when I call show() to show a closed window again

  • MainWindow::MainWindow(QWidget *parent) :
        ui(new Ui::MainWindow)
        QMainWindow *mm = new QMainWindow;
        mm->setAttribute(Qt::WA_DeleteOnClose, false);
        connect(ui->pushButton, &QPushButton::clicked, [=]{mm->show();});

    Hi, I use such code to show the window again. First time to click the button, sub-window popup normally.
    Then I close it by up-right "x". I click the button again to show sub-window, and found it stuck with short duration´╝î and then a strange window popup like below
    The background is part of my desktop.
    When I resize the sub-window. It's background redraw to normal.
    I have two question.

    1. What may cause the short stuck
    2. How to make the background normal by code, not by hand.


  • Lifetime Qt Champion

    What Qt version do you use? Please check with 5.12.5 since there were problems with 5.12.3/.4 wrt to your problem iirc.

  • @Christian-Ehrlicher
    Oh, Thanks. My version is 5.12.4.
    I use another version 5.9.3 and the bug is gone.

Log in to reply