How change font color for QMessageBox Label's?

Viewed 7020

What I mean

QMessageBox::question, QMessageBox::warning, QMessageBox::critical, QMessageBox::Information { /* Base Text Size & Color */
font-size:12px;
color:#ffffff;
}

If I try QmessageBox .QLabel it's change font for all form/windows

end how add background if I use global setting for all

QDialog {
border-image: url(':/images/image') 0 0 0 0 stretch stretch;
}

it's set , but how set only for this QMessageBoxes.

This I understand , but hv another problem, I add to background

QMessageBox QLabel {
background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0.5 rgba(0, 0, 0, 102));
border:0;
border-radius:6px;
font-size:10px;
font-weight:bold;
padding-left:5px;
padding-right:5px;
padding-top:5px;
padding-bottom:5px; 

but it add to icon to , how fix this ?

enter image description here

3 Answers

You can also set the color with tags inside the string passed as parameter to the QMessageBox:

QMessageBox::question(this, "Question", "<FONT COLOR='#ff0000'>Are you ready?</FONT>",
                                  QMessageBox::Yes|QMessageBox::No);

Question messageBox with font color red


Related