qt窗口坐标
新建一个mainwindow的工程,运行。
窗口的坐标:
代码:
1 //窗口左上角的位置(含边框) 2 qDebug() << "1(含边框):" << this->frameGeometry().x() << this->frameGeometry().y();//1 3 qDebug() << "2(含边框):" << this->x() << this->y();//2 4 qDebug() << "3(含边框):" << this->pos().x() << this->pos().y();//3 5 //窗口的宽度和高度(含边框) 6 qDebug() << "4(不含边框):" << this->frameGeometry().width() << this->frameGeometry().height(); 7 //窗口左上角的位置(不含边框) 8 qDebug() << "5(不含边框):" << this->geometry().x() << this->geometry().y(); 9 //窗口的宽度和高度(不含边框) 10 qDebug() << "6(不含边框):" << this->geometry().width() << this->geometry().height();//1 11 qDebug() << "7(不含边框):" << this->width() << this->height();//2 12 qDebug() << "8(不含边框):" << this->rect().width() << this->rect().height();//3 13 qDebug() << "9(不含边框):" << this->size().width() << this->size().height();//4
输出:
1(含边框): 989 578 2(含边框): 989 578 3(含边框): 989 578 4(不含边框): 902 519 5(不含边框): 1002 636 6(不含边框): 876 448 7(不含边框): 876 448 8(不含边框): 876 448 9(不含边框): 876 448
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
2021-10-13 linux(中标麒麟) 获取硬盘信息