当前位置:网站首页>Qt关于信号槽连接出现的一些问题记录
Qt关于信号槽连接出现的一些问题记录
2022-04-22 10:18:00 【yinchengkai】
在工作中遇到过几次通过connect来连接信号槽,出现一些报错的问题
1.编译出现没有发现槽函数的问题
QObject::connect: No such slot UserLogin::Login_Result(bool result,QString msg) in ..\FAWVW_BlueTest\BlueTest\userlogin.cpp:28
QObject::connect: (receiver name: 'UserLogin')
贴下我的错误的源码
connect(Global::pMesPlatform,SIGNAL(Sign_MesResult(bool ,QString)),this,SLOT(Mes_UpLoadResp(bool result,QString message)));
}
通过帮助文档,可以看到使用SIGNAL,SLOT方式的时候,信号槽函数只要填写参数类型,不能填写参数;所以改成Mes_UpLoadResp(bool ,QString )

总结:使用connect(sender,SIGNAL(),reciver,SLOT())的方式连接信号槽,一般用于重载的信号槽函数,就是说有多个函数名相同但是参数类型不同或者个数不同
如果没有上面的情况,建议使用这种connect方式:

connect(Global::pMesPlatform,&MesPlatform::Sign_MesResult,this,&MainWindow::Mes_UpLoadResp);
版权声明
本文为[yinchengkai]所创,转载请带上原文链接,感谢
https://blog.csdn.net/yinchengkai/article/details/124271389
边栏推荐
- Can Siemens PLC realize wireless communication through Ethernet data module?
- oracle中時間函數總結
- Two ways to write Coriolis (understand 'fn.length' and 'FN. Tostring()')
- source_ Insight is a method to create a new project and search for a variable or function in the whole document
- oracle19. 3 upgrade to 19.6
- 柯里化的两种写法(弄懂`fn.length`与`fn.toString()`)
- oracle19.3升级到19.6
- Cobbler cobbler cobbler
- .pm format perl
- idea 线程池debug断点跳不进去
猜你喜欢

UKUI3 支持 openEuler 22.03 LTS

最通俗易懂的依赖注入之生命周期

01背包问题——以及变形问题

Memory management-

浅析图片懒加载(三种实现方法与两种优化方式)

source_ Insight is a method to create a new project and search for a variable or function in the whole document

JWT源码浅析(四层封装,有示意图)

Analysis of image lazy loading (three implementation methods and two optimization methods)

头条面试居然跟我扯了半小时的Semaphore

Use of checkbox
随机推荐
DataGuard (ADG) spare database moves (migrates) data files
Two ways to write Coriolis (understand 'fn.length' and 'FN. Tostring()')
【无标题】
Leapftp: 425 failed to establish connection solution
5. Embedded controller (EC) learns PS / 2 protocol
Meituan side: have you used jstat, jmap, mat in the production time? Can you give me a practical example?
分享几个 Sklearn 模块中不为人知又超级好用的 API 函数
Ukui3 supports openeuler 22.03 LTS
SWOOLE高性能内存数据库的使用和配置教程
The root cause of Android's security vulnerability is Apple's lossless audio codec
idea 线程池debug断点跳不进去
5.嵌入式控制器(Embedded Controller,EC)学习 PS/2协议
分享一款投屏映射软件
Nacos
电脑清理C盘(系统盘)以及磁盘压缩(磁盘分区)、扩展(磁盘扩容)。
三分钟快速了解互动涂鸦
The debug breakpoint of idea thread pool cannot jump in
中商惠⺠交易中台架构演进:对 Apache ShardingSphere 的应⽤
Memory management-
SPA首屏加载优化