惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
The Blog of Author Tim Ferriss
Know Your Adversary
Know Your Adversary
P
Palo Alto Networks Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
K
Kaspersky official blog
L
LINUX DO - 热门话题
P
Proofpoint News Feed
P
Privacy & Cybersecurity Law Blog
Google DeepMind News
Google DeepMind News
Attack and Defense Labs
Attack and Defense Labs
Cisco Talos Blog
Cisco Talos Blog
AI
AI
L
LINUX DO - 最新话题
H
Heimdal Security Blog
Hacker News: Ask HN
Hacker News: Ask HN
Webroot Blog
Webroot Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
The GitHub Blog
The GitHub Blog
I
Intezer
Blog — PlanetScale
Blog — PlanetScale
有赞技术团队
有赞技术团队
S
Securelist
博客园_首页
IT之家
IT之家
Schneier on Security
Schneier on Security
博客园 - 叶小钗
罗磊的独立博客
WordPress大学
WordPress大学
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
MongoDB | Blog
MongoDB | Blog
P
Proofpoint News Feed
阮一峰的网络日志
阮一峰的网络日志
A
Arctic Wolf
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
W
WeLiveSecurity
The Register - Security
The Register - Security
D
DataBreaches.Net
S
Security @ Cisco Blogs
Security Archives - TechRepublic
Security Archives - TechRepublic
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
腾讯CDC
Recorded Future
Recorded Future
NISL@THU
NISL@THU
N
News and Events Feed by Topic
T
Tailwind CSS Blog
N
News and Events Feed by Topic
Cyberwarzone
Cyberwarzone
T
Tor Project blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com

博客园 - 吾非无心

MSB4019 找不到导入的项目“C:\Users\...\AppData\Local\QtMsBuild\vs-debugtools\qt_import.props” - 吾非无心 - 博客园 类/结构最后一个成员为类(string)时可能会出现“堆损坏”(HEAP CORRUPTION DETECTED)错误 GCC在C语言中内嵌汇编 asm __volatile__ QT删除python中的单行注释 double转int QJson 存储(u)longlong有问题 QT QPixmap QImage内存泄漏 QMetaObject::connectSlotsByName: No matching signal for QT数据库连接管理类 QT6 源码编译Win32 x86 vc++高精度计时sleep stack smashing detected 莫名其妙的错误 strdump的问题 再加一个realloc的问题 linux下简单封装读写锁 codeblocks下libacl配置 centos8 安装、配置redis6 pyftpdlib中文乱码的解决之道 CentOS8让uwsgi开机自动启动django(无需登录,无需手动) libevent学习一
QT多重继承带来的问题及解决办法,记录备查
吾非无心 · 2023-05-08 · via 博客园 - 吾非无心

多重继承connect时编译通不过。

网上很多办法是将QObject作为第一继承,确实可以解决一些问题。

但,这又会带来新问题,ui里设置的stylesheet或在代码里使用setStyleSheet不会生效——除非对单个widget使用setStyleSheet

m_pLabel_title_main->setStyleSheet("font-size:16px;font-weight:bold;color:white;font-family:\"Microsoft YaHei\";");        //可以
m_pFrame_container_main_title->setStyleSheet("background-color:rgb(0,100,177);");                                                     //可以

这样就不可以:

【this->】setStyleSheet("\

QLabel[objectName^=\"label_title_\"]{\
font-weight:bold;\
color:red;\
}");

如果不考虑使用ui设计器里使用stylesheet,可以直接“将QObject作为第一继承”


QObject::connect(ui.pushButton_2, &QPushButton::clicked, this, &Dialog_exam_ready::on_btn_exit_clicked);

如果希望使用批量stylesheet,可以这样做:

class Dialog_exam_ready : /*public QObject,*/ public QDialog, public ITcpClient

QDialog* pThis = this;
QObject::connect(ui.pushButton_2, &QPushButton::clicked, pThis, [&]() {on_btn_exit_clicked(); });

**第3、4参数     不能:       this, &Dialog_exam_ready::on_btn_exit_clicked