I create a QDialog and insert a QPushButton, which when clicked calls a QMainWindows, but QMainWindows only flashes on the screen, and will not appear.

here is the simple code:
Qt Code:
  1. login.h
  2. private slots:
  3. void Pushbutton_ok_click();
  4.  
  5. login.cpp
  6. connect(ui->pushButton_OK,SIGNAL(clicked()),this,SLOT(Pushbutton_ok_click()));
  7.  
  8. void Login::Pushbutton_ok_click()
  9. {
  10. MainWindow W;
  11. W.show();
  12. }
To copy to clipboard, switch view to plain text mode