当前位置:网站首页>Qt中发送信号时参数为结构体或者自定义的类怎么办?
Qt中发送信号时参数为结构体或者自定义的类怎么办?
2022-07-27 09:08:00 【新潮技术研究社】
大家平时发送signal的时候,估计用的比较多的就是基本类型,有时候也会用到容器类型,那么如果用到结构体或者类对象呢?怎么办?
这时候我们就需要使用qRegisterMetaType来先声明一下这个类。
用法如下:
qRegisterMetaType<MyClass>("MyClass")只需要将你的类名字放进去就可以了。至于调用的地方,一般可以在main函数中,也可以在类构造函数中,总之,需要在信号调用之前声明。
边栏推荐
- Rewrite the tensorrt version deployment code of yolox
- 【每日算法Day 94】经典面试题:机器人的运动范围
- 存储和计算引擎
- HUAWEI 机试题:字符串变换最小字符串 js
- [daily algorithm 94] classic interview question: motion range of robot
- PVT's spatial reduction attention (SRA)
- NiO example
- 5G没能拉动行业发展,不仅运营商失望了,手机企业也失望了
- Matlab uses m file to produce fuzzy controller
- Five kinds of 3D attention/transformer finishing (a-scn, point attention, CAA, offset attention, point transformer)
猜你喜欢

基于restful页面数据交互

音乐体验天花板!14个网易云音乐的情感化设计细节

js call和apply

【Flutter -- GetX】准备篇

As a VC, the auction house invested Web3 for the first time

Five kinds of 2D attention finishing (non local, criss cross, Se, CBAM, dual attention)

Aruba学习笔记10-安全认证-Portal认证(web页面配置)

NIO this.selector.select()
![[flutter -- geTx] preparation](/img/5f/96075fa73892db069db51fe789715a.png)
[flutter -- geTx] preparation

CUDA programming-02: first knowledge of CUDA Programming
随机推荐
Pymongo fuzzy query
Aruba学习笔记10-安全认证-Portal认证(web页面配置)
Restful
pollFirst(),pollLast(),peekFirst(),peekLast()
Horse walking oblique sun (backtracking method)
Flex layout (actual Xiaomi official website)
npm install报错 强制安装
07_ Service registration and discovery summary
MySQL基础知识学习(一)
[nonebot2] several simple robot modules (Yiyan + rainbow fart + 60s per day)
拍卖行做VC,第一次出手就投了个Web3
500报错
Activation functions commonly used in deep learning
Detailed explanation of two methods of Sqlalchemy
[I2C reading mpu6050 of Renesas ra6m4 development board]
The execution sequence of async/await, macro tasks and micro tasks
02 linear structure 3 reversing linked list
软件测试功能测试全套常见面试题【功能测试-零基础】必备4-1
MATLAB data import -- importdata and load functions
Pyqt5 rapid development and practice 4.1 qmainwindow