[英]How to make the title bold?
In QMessageBox
how can I make the title text bold? 在
QMessageBox
如何使标题文本加粗? Here is the sample code, which I am using to disply a messagebox: 这是示例代码,我用于显示消息框:
int ret = QMessageBox::warning(this, tr("My Application"),
tr("document has been modified.\n"
"Do you want to save your changes?"),
QMessageBox::Save | QMessageBox::Discard
| QMessageBox::Cancel,
QMessageBox::Save);
I just want tr("My Application")
to be bold, and rest to be in normal font. 我只希望
tr("My Application")
为粗体,其余部分为普通字体。 How can I do that? 我怎样才能做到这一点?
By default I am getting the normal font for both title and descriptive text. 默认情况下,标题和描述性文本都使用普通字体。
Thanks. 谢谢。
You can add some HTML-like formatting to the message box contents, ie : 您可以在消息框内容中添加一些类似HTML的格式,即:
// ...
"Do you want to save your <b>changes</b>?"),
// ...
I do not have access to S60 environment to check if it works for message box title too. 我没有访问S60环境的权限,也无法检查它是否也适用于消息框标题。 It doesn't work on Windows, but hey, it's worth a shot.
它在Windows上不起作用,但是,值得一试。
这是不可能的,因为大多数窗口管理器不允许在窗口标题内使用富文本格式。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.