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());

即可居中显示咯

相关推荐
疯狂的喵13 小时前
C++编译期多态实现
开发语言·c++·算法
2301_7657031413 小时前
C++中的协程编程
开发语言·c++·算法
m0_7487080513 小时前
实时数据压缩库
开发语言·c++·算法
lly20240614 小时前
jQuery Mobile 表格
开发语言
惊讶的猫14 小时前
探究StringBuilder和StringBuffer的线程安全问题
java·开发语言
m0_7482331715 小时前
30秒掌握C++核心精髓
开发语言·c++
Fleshy数模15 小时前
从数据获取到突破限制:Python爬虫进阶实战全攻略
java·开发语言
Duang007_15 小时前
【LeetCodeHot100 超详细Agent启发版本】字母异位词分组 (Group Anagrams)
开发语言·javascript·人工智能·python
froginwe1115 小时前
Redis 管道技术
开发语言
u01092727115 小时前
C++中的RAII技术深入
开发语言·c++·算法