16,801
社区成员




MainWindow *main_window;
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow *main_window = new MainWindow ();
main_window->show();
return a.exec();
}
进入子窗口,隐藏主窗口,LZ可以先show,再hide或者close什么的,可以防止界面一闪一闪的
sw.show();
this->close();
从子窗口回来:
main_window->show();
this->close();
void frmMain::on_pushButton_clicked()
{
this->hide();
QDialog dlg(this);
int res = dlg.exec();
if (res == QDialog::Accepted)
{
QMessageBox::information(this, "INFORMATION", "You clicked OK button!");
}
if (res == QDialog::Rejected)
{
QMessageBox::information(this, "INFORMATION", "You clicked CANCEL button!");
}
this->show();
}