Search code examples
c++qtqmessagebox

HTML in QMessageBox


I have an action which create QMessageBox. In that dialog I want to print a list, which contains several items. I have the following code:

void MainWindow::onAboutActivated(){
qDebug() << "about";
QMessageBox::about(this,
                   "Autor: \n"
                   "\n"
                   "Umoznuje:"
                   "<ul>"
                   "<li> Item 1 </li>"
                   "<li> Item 2 </li>"
                   "<li> Item 3 </li>"
                   "</ul>");

However this does not print the list, but text with html tags. How can I print the list? Any ideas?


Solution

  • Don't mix newlines \n with html-tags. Change the newlines to <br> and then the text format is automatically recognized.