怎么把标题加粗呢?
在QMessageBox
中如何使标题文本变为粗体? 下面是示例代码,我用它来显示消息框:
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);
我只希望 tr("My Application") 为粗体,其余为正常字体。 我怎样才能做到这一点?
默认情况下,我获得标题和描述性文本的正常字体。
谢谢。
In QMessageBox
how can I make the title text bold?
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.
How can I do that?
By default I am getting the normal font for both title and descriptive text.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以向消息框内容添加一些类似 HTML 的格式,即:
我无法访问 S60 环境来检查它是否也适用于消息框标题。它不适用于 Windows,但是,嘿,值得一试。
You can add some HTML-like formatting to the message box contents, i.e. :
I do not have access to S60 environment to check if it works for message box title too. It doesn't work on Windows, but hey, it's worth a shot.
这是不可能的,因为大多数窗口管理器不允许在窗口标题中包含富文本。
This is not possible since most window managers do not allow rich text inside the window title.