简体   繁体   中英

How to make the title bold?

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.

You can add some HTML-like formatting to the message box contents, ie :

// ...
"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. It doesn't work on Windows, but hey, it's worth a shot.

这是不可能的,因为大多数窗口管理器不允许在窗口标题内使用富文本格式。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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