I'm using a QMessageBox to show a pop-up text message on the mainwindow on my application.

I've enabled the 'NoIcon' option and am seeing that the message text is not centred.

Is there a way to centre the text within the widget. I assume the Icon widget is still taking up space within the QMessageBox, is there a way to hide the icon entirely?

Capture.PNG

Code example below

Qt Code:
  1. messageBox = new QMessageBox(QMessageBox::NoIcon, QString(), messageText, QMessageBox::NoButton, this, Qt::FramelessWindowHint);
  2. messageBox->setText(messageText);
  3. messageBox->setStyleSheet(QString("background-color: #FFFFFF; \
  4. color:rgb(0,0,0); \
  5. font-size: 30px; \
  6. QMessageBox { border-color: rgb(0, 0, 0); \
  7. border-style: solid; \
  8. border-width: 3px; }"));
  9. messageBox->setStandardButtons(QMessageBox::NoButton);
  10. messageBox->exec();
To copy to clipboard, switch view to plain text mode