首页 > 其他 > 详细

使用emit发出信号

时间:2017-03-31 21:31:45      阅读:654      评论:0      收藏:0      [点我收藏+]

1. 信号声明

在发送信号的模块类头文件中声明信号函数

signals:
void sendRate(QString rate);

 

2. 在发送模块的成员函数中发出信号

emit sendRate(ui.lineEdit_2->text());

 

3. 在接受信号的模块头文件找中声明槽函数

private slots:
void receiveRate(QString rate);

4. 在接受信号的.cpp文件中编写槽函数

void CCSDS122::receiveRate(QString rate)
{
ui.textBrowser_Pix->setText(rate);
}

5. 连接信号和槽

connect(dialog2, SIGNAL(sendRate(QString)), this, SLOT(receiveRate(QString)));

使用emit发出信号

原文:http://www.cnblogs.com/my-cat/p/6653540.html

(1)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!