1、 cannot open *** file 可能是没有关掉刚刚运行的窗口
2、 ** dose not name a type 可能是没有包含头文件
3、 窗口一闪而过
4、 QT登录窗口调用主窗口一闪而过有关问题
www.MyException.Cn 发布于:2012-11-1110:07:57 浏览:72次
QT登录窗口调用主窗口一闪而过问题
原代码:
//如果登录成功
{
index mainForm;
mainForm.show();
this->hide();
}
主窗口一闪而过
修改为:
//如果登录成功
{
index mainForm = new inde();
mainForm.show();
this->hide();
}
程序报错
修改为:
/如果登录成功
{
index *mainForm;
mainForm = new index();
mainForm->show();
this->hide();
}
成功显示主窗口。
总结:
index mainForm;
mainForm.show();
mainForm创建在stack上,生命期是大括号内
index *mainForm;
mainForm = new index();
mainForm 通过new创建在heap上,在程序退出时才会被析构
5、 connect
connect(enterBtn,SIGNAL(QPushButton::clicked()),this,SLOT(newmain()));这句话错了,应该是connect(enterBtn,SIGNAL(clicked()),this,SLOT(newmain()));
原文:http://blog.csdn.net/u011026968/article/details/21560971