Search code examples
qtqt-designerqtstylesheetsqlabelqmessagebox

How change font color for QMessageBox Label's?


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


Solution

  • Have you tried:

    QMessageBox {
        background-color: rgb(51, 51, 51);
    }
    
    QMessageBox QLabel {
        color: rgb(200, 200, 200);
    }
    

    http://doc.qt.io/qt-5/stylesheet-syntax.html