主题 : 求助!!!Qt界面相互通信 复制链接 | 浏览器收藏 | 打印
级别: 新手上路
UID: 57867
精华: 0
发帖: 10
金钱: 50 两
威望: 10 点
综合积分: 20 分
注册时间: 2011-10-31
最后登录: 2012-08-02
楼主  发表于: 2012-07-20 22:01

 求助!!!Qt界面相互通信

做了两个界面,主界面为spray,子界面为setdialog,想实现如下功能,在子界面的输入框里输入一个参数,然后在主界面显示,下面是主要的代码,各位大侠看看错误在哪
子程序相关函数
SetDialog::SetDialog(QWidget *parent) :
…………
connect(ui->pushButton,SIGNAL(clicked()),this,SLOT(twotest1()));
……
void SetDialog::twotest1()
{
    emit t();
    this->hide();
}
主程序相关函数
Spray::Spray(QWidget *parent) :
……
connect(ui->setpushButton,SIGNAL(clicked()),this,SLOT(test1()));
connect(&setdialog,SIGNAL(t()),this,SLOT(test3()));
……
void Spray::test1()
{
    setdialog.show();
    this->hide();
}
void Spray::test3()
{
    this->show();
    value = &setdialog->lineEdit->text();
    
}
Value是主程序里面的值