qt中不同类(class)的信号发送(emit)说明2-转
(2015-09-07 15:55:45)
标签:
股票it |
分类: 计算机 |
原文网址: http://blog.163.com/ojb_123/blog/static/24177424201172711316454/
main中的类为A,另一个类为B
B改变了某个值或发生了某个时间,发送一个信号,A通过connect连接检测到信号,然后运行对应的函数
main.c
other_class other_class=new other_class;
添加一个连接
connect(other_class,SIGNAL(other_class_signal()),this,SLOT(main_update()));
main.h
添加新类的头文件
include
other_class.h
在新类的头文件中添加信号的定义
signals:
other_class.c
在新类的c文件的函数中发送信号
emit change();