简体   繁体   English

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

[英]where to set the font of a qdialog in QT?

am creating a tool with QT creator, that should run on linux only我正在使用 QT 创建者创建一个工具,该工具应仅在 linux 上运行

now i am setting the font for my whole app, this is how:现在我正在为我的整个应用程序设置字体,这就是:

QApplication myApplication(argc, argv);

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

however, am not able until now to set the font taking effect on the window title, message boxes or custom dialogs...但是,直到现在我才能设置字体对 window 标题、消息框或自定义对话框生效...

is this not supported at all because of the windows manager??由于 windows 管理器,这根本不支持吗?

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

If your question concerns the font associated to the title, i do not think there is a way to change it because it is managed by the Window Manager according to this and this and also here如果您的问题涉及与标题关联的字体,我认为没有办法更改它,因为它是由 Window 管理器根据thisthis以及here

May be a resource to try to draw the window title bar in QT can be found here , which I tried but it is a little of a hack where you hide the real title bar and redraw a text over it and then you format the text using a css.可能是尝试在QT中绘制 window 标题栏的资源,我尝试过,但它有点像 hack,您可以隐藏真正的标题栏并在其上重绘文本,然后使用一个 css。 Other resources but using Python ( How to customize title bar and window of desktop application )其他资源,但使用 Python( 如何自定义桌面应用程序的标题栏和 window

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM