Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Unexpected behaviour when I call show() to show a closed window again

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

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 262 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mr Pang
    wrote on last edited by
    #1
    MainWindow::MainWindow(QWidget *parent) :
        QMainWindow(parent),
        ui(new Ui::MainWindow)
    {
        ui->setupUi(this);
        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.
    Screenshot_20191016_094624.png
    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
    Screenshot_20191016_094710.png
    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.

    Thanks!

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      M 1 Reply Last reply
      0
      • Christian EhrlicherC Christian Ehrlicher

        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.

        M Offline
        M Offline
        Mr Pang
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved