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.
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?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With