当前位置:网站首页>QT笔记——Q_Q 和Q_D 学习
QT笔记——Q_Q 和Q_D 学习
2022-07-26 03:10:00 【旧街凉风°】
在源码中,我们会经常看到Q_Q 和 Q_D 这两个东西 ,很好奇,就去网上搜索了一些和 查看了一些源码 部分
Q_D相关宏
#define Q_D(Class) Class##Private * const d = d_func()
Q_D(Test)
//展开后 是一个 私有类的指针常量
TestPrivate * const d = d_func();
d_func()
QScopedPointer<QPainterPathPrivate, QPainterPathPrivateDeleter> d_ptr;
QPainterPathData *d_func() const {
return reinterpret_cast<QPainterPathData *>(d_ptr.data()); }
Q_DECLARE_PRIVATE(Class)
#define Q_DECLARE_PRIVATE(Class) \ inline Class##Private* d_func() \ {
Q_CAST_IGNORE_ALIGN(return reinterpret_cast<Class##Private *>(qGetPtrHelper(d_ptr));) } \ inline const Class##Private* d_func() const \ {
Q_CAST_IGNORE_ALIGN(return reinterpret_cast<const Class##Private *>(qGetPtrHelper(d_ptr));) } \ friend class Class##Private;
Q_DECLARE_PRIVATE(Test)
//展开后
inline TestPrivate* d_func() {
return reinterpret_cast<TestPrivate *>(qGetPtrHelper(d_ptr));}
inline const TestPrivate* d_func() const{
return reinterpret_cast<const TestPrivate *>(qGetPtrHelper(d_ptr));}
friend class TestPrivate;
Q_Q相关宏
#define Q_Q(Class) Class * const q = q_func()
**Q_DECLARE_PUBLIC(Class) **
#define Q_DECLARE_PUBLIC(Class) \ inline Class* q_func() {
return static_cast<Class *>(q_ptr); } \ inline const Class* q_func() const {
return static_cast<const Class *>(q_ptr); } \ friend class Class;
Q_DECLARE_PUBLIC(Test)
inline Test* q_func() {
return static_cast<Test*>(q_ptr); }
inline const Test* q_func() const {
return static_cast<const Test*>(q_ptr); }
friend class Test;
边栏推荐
- Canvas -- drawing of rectangle -- making of histogram
- Unity快速搭建城市场景
- [noip2001 popularization group] the problem of maximum common divisor and minimum common multiple
- els 修改光标、修改图标
- Win11麦克风权限的开启方法
- 文件操作(一)——文件简介与文件的打开方式和关闭
- The difference between the world wide web, the Internet and the Internet
- Golang 中‘...‘的用法
- Dataframe sorting: datetime format splitting; Delete a specific line; Group integration.
- GoLang日志编程系统
猜你喜欢

中国信通院陈屹力:降本增效是企业云原生应用的最大价值

STM32 - PWM learning notes

Istio三之VirtualService、Gateway、DestinationRule配置使用

记一次SQL优化

"Xiao Deng's view" the value brought by Siem to enterprises (II)

小测(一)

Keyboardtraffic, a tool developed by myself to solve CTF USB keyboard traffic

如何用U盘进行装机?

Win11更改磁盘驱动器号的方法

【C语言】深入理解 整型提升 和 算术转换
随机推荐
Teach you to rely on management hand in hand
ByteDance (Tiktok) software test monthly salary 23K post, technical two-sided interview questions are newly released
What is the difference between heap memory and stack memory?
[SQL] 自连接的用法
Matlab simulation of vertical handover between MTD SCDMA and TD LTE dual networks
Standardize your own debug process
在混合云中管理数据库:八个关键注意事项
els 注册窗口类、创建窗口类、显示窗口
How to close the case prompt icon of win11? Closing method of win11 case prompt Icon
小测(一)
Golang 中‘...‘的用法
【C进阶】深入探索数据的存储(深度剖析+典例解读)
Three years of software testing experience, salary has been stuck at 10K, how to improve and develop automated testing?
Win11隐藏输入法状态栏方法
了解预加载和懒加载、学会缓动动画
Canvas -- draw curve -- wall clock, pie chart, five pointed star
中国信通院陈屹力:降本增效是企业云原生应用的最大价值
Canvas - ECG design and how to clean the canvas
Influence of middle tap change on ZVS oscillation circuit
hello world驱动(二)-初级版