#include "MainView.h"
MainView::MainView(QObject* parent):QObject(parent)
{
// Qt::ConnectionType ctype = Qt::DirectConnection;
qRegisterMetaType<Copy>("Copy");
Qt::ConnectionType ctype = Qt::QueuedConnection;
connect(this, SIGNAL(sendConstRef(Copy)),
this, SLOT(receiveConstRef(Copy)), ctype);
// connect(this, SIGNAL(sendValue(Copy)),
// this, SLOT(receiveConstRef(Copy)), ctype);
// connect(this, SIGNAL(sendConstRef(Copy)),
// this, SLOT(receiveValue(Copy)), ctype);
// connect(this, SIGNAL(sendValue(Copy)),
// this, SLOT(receiveValue(Copy)), ctype);
}
void MainView::testSignaleSlot()
{
Copy c(1, "James");
//emit sendValue(c);
emit sendConstRef(c);
}
void MainView::receiveValue(Copy c){
qDebug() << "receiveValue id: " << c.m_id;
qDebug() << "receiveValue name: " << c.m_name;
}
void MainView::receiveConstRef(const Copy &c)
{
qDebug() << "receiveConstRef id: " << c.m_id;
qDebug() << "receiveConstRef name: " << c.m_name;
}
Qt信号槽中的信号传递对比
需积分: 50 182 浏览量
2020-03-09
16:50:04
上传
评论
收藏 2KB ZIP 举报
heisenberg07
- 粉丝: 28
- 资源: 20
最新资源
- mosquitto-2.018-install-windows-x64
- FTPServer FTP 服务器,绿色免安装,单文件
- 梦畅语音点名软件,上课点名
- 利用ADNI数据集和标签,在tensorflow框架上使用tensorlayer接口,通过架构u-net实现海马体的分割
- Kutools for Word v9.0 office word 插件
- 修复Windows 10 LTSC 2021资源占用率高
- Hash工具,小巧绿色hash校验工具,免费hash工具
- 重启进行BIOS快捷方式,不需要开机按BIOS键
- 鸭子开车记(儿童绘本)
- 威纶通触摸屏编程软件Easy builder pro V6.09.01.556安装包(2024.04).txt
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈