当前位置:网站首页>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 .
边栏推荐
- [ue4] cascading shadow CSM
- pyQt界面制作(登录+跳转页面)
- tonybot 人形机器人 首次开机 0630
- Luogu p5018 [noip2018 popularization group] symmetric binary tree problem solution
- cpu飙升排查方法
- [qingniaochangping campus of Peking University] in the Internet industry, which positions are more popular as they get older?
- Zzuli:1049 square sum and cubic sum
- Sword finger offer 28 Symmetric binary tree
- 7-3 rental (20 points)
- Puzzle (016.4) domino effect
猜你喜欢
[ue4] cascading shadow CSM
C language DUP function
Analysis of gene family characteristics - chromosome location analysis
adc128s022 ADC verilog设计实现
远程服务器后台挂起 nohup
tonybot 人形機器人 紅外遙控玩法 0630
零拷贝底层剖析
论文分享:Generating Playful Palettes from Images
ASTC texture compression (adaptive scalable texture compression)
Sub-GHz无线解决方案Z-Wave 800 系列ZG23 soc和ZGM230S模块
随机推荐
Rasterization: a practical implementation (2)
Zzuli: sum of 1051 square roots
Use of form text box (I) select text
Tonybot Humanoïde Robot Infrared Remote play 0630
光猫超级账号密码、宽带账号密码 获取
cpu飙升排查方法
[opengl] pre bake using computational shaders
Adc128s022 ADC Verilog design and Implementation
[engine development] in depth GPU and rendering optimization (basic)
Zzuli:1046 product of odd numbers
pyQt界面制作(登录+跳转页面)
【微信小程序】WXSS 模板样式
Frequently asked questions: PHP LDAP_ add(): Add: Undefined attribute type in
Showmebug entered Tencent conference, opening the era of professional technical interview
Zzuli:1059 highest score
Tailing rushes to the scientific and Technological Innovation Board: it plans to raise 1.3 billion, and Xiaomi Changjiang is the shareholder
tonybot 人形機器人 紅外遙控玩法 0630
tonybot 人形机器人 红外遥控玩法 0630
洛谷P4047 [JSOI2010]部落划分 题解
US stock listing of polar: how can the delivery of 55000 units support the valuation of more than 20billion US dollars