如何在Qt程序实现简单的窗口跳转
1个回答
2016-11-15
展开全部
窗口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;
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;
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询