当前位置:网站首页>Qt中发送信号时参数为结构体或者自定义的类怎么办?
Qt中发送信号时参数为结构体或者自定义的类怎么办?
2022-07-27 09:08:00 【新潮技术研究社】
大家平时发送signal的时候,估计用的比较多的就是基本类型,有时候也会用到容器类型,那么如果用到结构体或者类对象呢?怎么办?
这时候我们就需要使用qRegisterMetaType来先声明一下这个类。
用法如下:
qRegisterMetaType<MyClass>("MyClass")只需要将你的类名字放进去就可以了。至于调用的地方,一般可以在main函数中,也可以在类构造函数中,总之,需要在信号调用之前声明。
边栏推荐
- [acl2020] a novel method of component syntax tree serialization
- Storage and computing engine
- 全排列递归思路整理
- Programming style
- Mangodb simple to use
- 2040: [Blue Bridge Cup 2022 preliminary] bamboo cutting (priority queue)
- New year's goals! The code is more standardized!
- MySQL基础知识学习(一)
- 2034: [Blue Bridge Cup 2022 preliminary] pruning shrubs
- Arm system call exception assembly
猜你喜欢

一些实用、常用、效率越来越高的 Kubernetes 别名

Explain cache consistency and memory barrier

Pyqt5 rapid development and practice 4.1 qmainwindow

NIO this.selector.select()

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

08_ Service fusing hystrix

Flex layout (actual Xiaomi official website)

Activation functions commonly used in deep learning

A survey of robust lidar based 3D object detection methods for autonomous driving paper notes

Understand various IOU loss functions in target detection
随机推荐
Matlab 利用M文件产生模糊控制器
Pytorch custom CUDA operator tutorial and runtime analysis
linux下安装oracle,本地PL/SQL连接Linux下的oracle导入表并新建用户和密码
存储和计算引擎
CUDA programming-05: flows and events
How to deploy yolov6 with tensorrt
5g failed to stimulate the development of the industry, which disappointed not only operators, but also mobile phone enterprises
A survey of robust lidar based 3D object detection methods for autonomous driving paper notes
接口测试工具-Postman使用详解
数智革新
Horse walking oblique sun (backtracking method)
Understand various IOU loss functions in target detection
Solve the problem of Chinese garbled code on the jupyter console
Hangzhou E-Commerce Research Institute released an explanation of the new term "digital existence"
全排列递归思路整理
Cross domain and processing cross domain
Tensorflow loss function
【Flutter -- GetX】准备篇
Interface test tool -postman usage details
C# 窗体应用常用基础控件讲解(适合萌新)