当前位置:网站首页>QT program font becomes larger on computers with different resolutions, overflowing controls
QT program font becomes larger on computers with different resolutions, overflowing controls
2022-07-03 14:49:00 【Jack1009HF】
QT The font of the program becomes larger on computers with different resolutions , The solution of overflow control
Preface
In the recent development process , Found running locally QT Program , There is no problem with the display interface , But on other computers, the font has become larger , Overflow control phenomenon .
- The local operation display is normal , The font can be displayed normally .

- Run on other computers , The font display is abnormal , Change in size , Overflow control .

reason
Qt Font in Qfont There are two ways to define font size , One is PointSize, The other is PixelSize.
- PointSize The unit of is not pixels , It is based on the actual size of the font displayed on the screen , It is related to the resolution of the screen and the real size of the screen , That is, its unit is the font size displayed on the screen .
- PixelSize It's actually in pixels , namely PixelSize The size of is the actual pixel size .
Development process ,QT The default is PointSize How to set it up , So the font size will appear on computers with different resolutions 、 Abnormal position of the control .
terms of settlement
1.main Function to set the global font

QFont font(QStringLiteral("Tahoma")); // Set a font
font.setPixelSize(12); // font size , Equate to PointSize Of 9 Point size
qApp->setFont(font);
2.QT Creator Add style sheets to
stay QT Creator Of UI Right click the interface , choice “ Change the style sheet ”

single click “ Add the font ”

Be careful , The default font used here is PointSize, Need to change to PixelSize, hold 9pt Change it to 12px that will do .

effect
Run again , The interface display returns to normal .
边栏推荐
- Qt development - scrolling digital selector commonly used in embedded system
- Zhonggan micro sprint technology innovation board: annual revenue of 240million, net loss of 17.82 million, proposed to raise 600million
- 7-10 stack of hats (25 points) (C language solution)
- QT - draw something else
- Puzzle (016.3) is inextricably linked
- Pyqt interface production (login + jump page)
- .NET六大设计原则个人白话理解,有误请大神指正
- [ue4] material and shader permutation
- Zzuli:1056 lucky numbers
- Several sentences extracted from the book "leather bag"
猜你喜欢

556. The next larger element III

tonybot 人形机器人 红外遥控玩法 0630
![洛谷P5018 [NOIP2018 普及组] 对称二叉树 题解](/img/89/da1a3a38e02671628f385de0f30369.png)
洛谷P5018 [NOIP2018 普及组] 对称二叉树 题解

Qt development - scrolling digital selector commonly used in embedded system
![[graphics] hair simulation in tressfx](/img/41/cef55811463d3a25a29ddab5278af0.jpg)
[graphics] hair simulation in tressfx

tonybot 人形机器人 定距移动 代码编写玩法

Amazon, express, lazada, shopee, eBay, wish, Wal Mart, Alibaba international, meikeduo and other cross-border e-commerce platforms evaluate how Ziyang account can seize traffic by using products in th
![[qingniaochangping campus of Peking University] in the Internet industry, which positions are more popular as they get older?](/img/f6/fe61c84f289f0e74a45946dac687a6.jpg)
[qingniaochangping campus of Peking University] in the Internet industry, which positions are more popular as they get older?

Dllexport et dllimport

retrofit
随机推荐
Protobuf and grpc
Optical cat super account password and broadband account password acquisition
Rasterization: a practical implementation (2)
牛客 BM83 字符串变形(大小写转换,字符串反转,字符串替换)
Four data flows and cases of grpc
[combinatorics] permutation and combination (set combination, one-to-one correspondence model analysis example)
创业团队如何落地敏捷测试,提升质量效能?丨声网开发者创业讲堂 Vol.03
Yolov5进阶之七目标追踪最新环境搭建(二)
Zzuli:1054 monkeys eat peaches
Get permissions dynamically
洛谷P3065 [USACO12DEC]First! G 题解
NOI OPENJUDGE 1.6(09)
.NET六大设计原则个人白话理解,有误请大神指正
Qt development - scrolling digital selector commonly used in embedded system
Write a 2-minute countdown.
洛谷P5018 [NOIP2018 普及组] 对称二叉树 题解
分布式事务(Seata) 四大模式详解
Zzuli:1056 lucky numbers
QT - draw something else
[ue4] material and shader permutation