项目场景:
MSYS2 升级到 Qt6.7.0,发现显示故障,所有Qt6程序以及 QtCreator的SpinBox都显示不全,Combox的底色不对。
问题描述
2024年4月1日,pacman升级MSYS2后,Qt6遇到风格错误。
msys环境:
user@worker UCRT64 ~
$ qmake6 --version
QMake version 3.1
Using Qt version 6.7.0 in C:/msys64/ucrt64/lib
Qt Creator 13.0.0
故障 windows环境:
$screenfetch.., guest@localhost....,,:;+ccllll OS: Microsoft Windows 11 Home Edition (v10.0.22631) 64-bit...,,+:; cllllllllllllllllll Kernel: x86_64 MINGW64_NT-10.0-22631 3.4.10.x86_64,cclllllllllll lllllllllllllllllll Uptime: 503mllllllllllllll lllllllllllllllllll Packages: 1307llllllllllllll lllllllllllllllllll Shell: bash 5.2.26llllllllllllll lllllllllllllllllll Resolution: 1920x1080llllllllllllll lllllllllllllllllll DE: Modern UI/Metrollllllllllllll lllllllllllllllllll WM: DWM/ExplorerWM Theme:Themesaerollllllllllllll lllllllllllllllllll CPU: Intel Core i7-10510U @ 8x 2.31GHzllllllllllllll lllllllllllllllllll GPU: Intel(R) UHD Graphicsllllllllllllll lllllllllllllllllll RAM: 4172MiB / 24306MiBllllllllllllll lllllllllllllllllllllllllllllllll lllllllllllllllllll`'ccllllllllll lllllllllllllllllll`'""*:: :ccllllllllllllllll````''"*::cll``
错误图片:
上图的spinBox里的文字全部显示不全。
上图帮助系统中,ComboBox弹出的选项列表背景前景几乎一样,看不清
原因分析:
这个问题是错误的StyleSheet导致的。应该是Qt 6.7 的 windows 11风格没有在各种 DPI下进行严格的测试。
解决方案:
最简单的方法是用fusion主题或者其他主题启动 QtCreator:
$ qtcreator --style fusion
此问题应该很快会解决。