当前位置:网站首页>error: C2665: “QMessageBox::critical”: 4 个重载中没有一个可以转换所有参数类型
error: C2665: “QMessageBox::critical”: 4 个重载中没有一个可以转换所有参数类型
2022-06-29 22:23:00 【妙为】
Qt系列文章目录
前言
在使用QMessageBox::criticalQtCreator编译器报错:
E:\QtExercise\QtReadWriteXml\QtXmlDom\QtXmlDom\AnalysisTrackDpj.cpp:39: error: C2665: “QMessageBox::critical”: 4 个重载中没有一个可以转换所有参数类型
一、问题原因
1.首先想到没有包含QMessageBox头文件,于是包含QMessageBox头文件,但问题依旧没有解决
2.让自己定义的AnalysisTrackDpj类继承QMessageBox
虽然编译通过了,也能正常运行,
但编译器给出了警告:direct base ‘QObject’ is inaccessible due to ambiguity:
想想也是我让AnalysisTrackDpj分别继承QObject和QMessageBox,而QMessageBox又继承QObject,总感觉是有问题的
3.将this改成0
通过不断测试与查阅资料发现是this指针的问题。因为information静态函数第一个参数类型为QWidget* parent。而我的DatabaseOperatoor.cpp里面没有创建窗口,把this传给information,编译器无法确定其父窗口是谁。解决办法就是将this改成0,表示我就是顶层窗口,解决问题。
详细表述可以点击c++ - About Qt MessageBox::warning() overloading - Stack Overflow进行查看
参考
边栏推荐
- 利用kubernetes中的leader选举机制来完成自己的HA应用
- STM32基础知识点
- Three development trends of enterprise application viewed from the third technological revolution
- 从零实现深度学习框架——RNN从理论到实战【实战】
- Number theory - division and blocking
- Grep tool
- [php8+oracle11g+windows environment without tools] Intranet / no network /win10/php connecting to Oracle database instance
- 服务器快速搭建AList集成网盘网站【宝塔面板一键部署AList】
- MySQL backup database Linux
- VS2013如何让编写的程序在其它电脑上面也能运行
猜你喜欢
The server quickly sets up the alist integrated network disk website [pagoda panel one click deployment of alist]
云原生爱好者周刊:炫酷的 Grafana 监控面板集合
Summer rainbow comes for dinner
Can you be a coder if you don't learn English well? Stop worrying and learn it first
Hezhou air32f103cbt6 development board hands-on Report
Ansible自动化运维
Digital tracking analysis of insurance services in the first quarter of 2022
#第三天
math_基本初等函数图型(幂函数/指数/对数/三角/反三角)
合宙AIR32F103CBT6开发板上手报告
随机推荐
地方/园区如何做好产业分析?
mysql备份数据库linux
一键式文件共享软件Jirafeau
Can cdc2.2.1 listen to multiple PgSQL libraries at the same time?
深入解析kubernetes中的选举机制
从检查点恢复后读取不到mysql的数据有那位兄台知道原因吗
5-1系統漏洞掃描
Introduction, deployment and application of moosefs
Spark cluster installation
阶段性总结与思考
Does rapid software delivery really need to be at the cost of security?
Laravel creates its own facade extension geoip to obtain country, region and city information according to IP
Nacos-配置中心基本使用
Taishan Office Technology Lecture: all elements in a row have the same height
MySQL 锁常见知识点&面试题总结
Hezhou air32f103cbt6 development board hands-on Report
从第三次技术革命看企业应用三大开发趋势
Number theory - division and blocking
AI场景存储优化:云知声超算平台基于 JuiceFS 的存储实践
MooseFS基本概念总结