QT 中 qdialog 的字体在哪里设置?

问题描述

正在使用 QT Creator 创建一个工具,该工具只能在 linux 上运行

现在我正在为我的整个应用设置字体,方法如下:

QApplication myApplication(argc,argv);

auto id{QFontDatabase::addApplicationFont(":/someFont.ttf")};
QString family{QFontDatabase::applicationFontFamilies(id).at(0)};
QFont myFont(family);
myApplication.setFont(myFont);

然而,直到现在我还不能设置在窗口标题、消息框或自定义对话框上生效的字体...

是不是因为windows管理器根本不支持这个??

enter image description here

enter image description here

enter image description here

解决方法

如果您的问题涉及与标题相关的字体,我认为没有办法更改它,因为它由窗口管理器根据 thisthis 以及 {{ 3}}

可能是尝试在 QT 中绘制窗口标题栏的资源可以找到 here,我尝试过,但它是一个小技巧,您可以隐藏真正的标题栏并在其上重新绘制文本然后使用 css 格式化文本。 其他资源但使用 Python (here)