Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML in QMessageBox

Tags:

People also ask

How do I use QMessageBox?

To use the property-based API, construct an instance of QMessageBox, set the desired properties, and call exec() to show the message. The simplest configuration is to set only the message text property. QMessageBox msgBox; msgBox. setText("The document has been modified."); msgBox.

How do I change the size of my QMessageBox?

You can edit the css of the label: msg. setStyleSheet("QLabel{min-width: 700px;}"); You can similarly edit the css of the buttons to add a margin or make them bigger.


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?