vs QT Use QGuiApplication::screens报错

严重性 代码 说明 项目 文件 行 禁止显示状态 错误 C4996 'QDesktopWidget::availableGeometry': Use QGuiApplication::screens(

解决方法:

QRect rect = w.frameGeometry();

QDesktopWidget desktop;

// QPoint centerPoint = desktop.availableGeometry().center();

// QPoint centerPoint = QGuiApplication::screens;

QPoint centerPoint= QGuiApplication::primaryScreen()->availableGeometry().center();

rect.moveCenter(centerPoint);

w.move(rect.topLeft());

即可居中显示咯

相关推荐
自由的好好干活20 小时前
使用Qoder编写ztdaq的C#跨平台示例2
开发语言·c#·ai编程
赵财猫._.1 天前
Native API开发:C++与ArkTS混合编程实战
开发语言·c++·harmonyos
普通网友1 天前
基于C++的操作系统开发
开发语言·c++·算法
狂团商城小师妹1 天前
JAVA外卖霸王餐CPS优惠CPS平台自主发布小程序+公众号霸王餐源码
java·开发语言·小程序
2501_941111341 天前
C++中的策略模式高级应用
开发语言·c++·算法
心软小念1 天前
用Python requests库玩转接口自动化测试!测试工程师的实战秘籍
java·开发语言·python
sanggou1 天前
【Python爬虫】手把手教你从零开始写爬虫,小白也能轻松学会!(附完整源码)
开发语言·爬虫·python
普通网友1 天前
C++与Qt图形开发
开发语言·c++·算法
yue0081 天前
C# 更改窗体样式
开发语言·c#
普通网友1 天前
C++中的适配器模式
开发语言·c++·算法