如何在Qt程序实现简单的窗口跳转

 

窗口1 :

Widget
namespace Ui {
    class Widget;
    class Form;
}

构造函数加入:connect(btn1,SIGNAL(clicked()),this,SLOT(open1()));

void Widget::open1()
{
    this->hide();
    w1 = new Form;
    w1->show();
    connect(this->w1->f_ui->pushButton,SIGNAL(clicked()),this,SLOT(Display()));

}

void Widget::Display()
{
    this->show();
     w1->close();
}
窗口2 :

Form
#include "ui_form.h"
public:
 Ui::Form *f_ui;

你可能感兴趣的:(UI,Class,qt,Signal)