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
messageBox->setText(messageText);
messageBox
->setStyleSheet
(QString("background-color: #FFFFFF; \ color:rgb(0,0,0); \
font-size: 30px; \
QMessageBox { border-color: rgb(0, 0, 0); \
border-style: solid; \
border-width: 3px; }"));
messageBox->exec();
messageBox = new QMessageBox(QMessageBox::NoIcon, QString(), messageText, QMessageBox::NoButton, this, Qt::FramelessWindowHint);
messageBox->setText(messageText);
messageBox->setStyleSheet(QString("background-color: #FFFFFF; \
color:rgb(0,0,0); \
font-size: 30px; \
QMessageBox { border-color: rgb(0, 0, 0); \
border-style: solid; \
border-width: 3px; }"));
messageBox->setStandardButtons(QMessageBox::NoButton);
messageBox->exec();
To copy to clipboard, switch view to plain text mode
Bookmarks