[Qt-interest] setting background color of QMessageBox

Oliver Demetz forenbeitraege at oliverdemetz.de
Sat May 23 13:32:20 CEST 2009


Hi

You're not using the messagebox that you specified the stylesheet for.
QMessageBox msgBox;
msgBox.setStyleSheet(QString::fromUtf8("background-color: rgb(241, 241, 
241);"));
int ret = msgBox.warning(...)


Chandru... schrieb:
> 
> hi friends,
> i am using QMessageBox to dispaly warning if the user press a pushButton ..
> i coded like this:
> 
> --  QMessageBox msgBox;
>         msgBox.setStyleSheet(QString::fromUtf8("background-color: 
> rgb(241, 241, 241);"));
> 
>         int ret = QMessageBox::warning(this, tr("My Application"),
>                                 tr("<font color = red >Are you sure you 
> want to quit?.\n"
>                                    "Shut Down  key is pressed </font >"),
>                                 QMessageBox::Ok | QMessageBox::Cancel);
> 
>          switch (ret) {
>                  case QMessageBox::Ok :
>                         qApp->quit();
>                         break;
> 
>                  case QMessageBox::Cancel :
>                         break;
> 
>                 default :
>                         break;
> 
>         }
> rendered using the default stylesheet of app .. it is pure black in 
> background color ..
> the text are not visible ... so i use <font > in constructor of 
> QMessage::warning ..
> 
> but i cant set font color of buttons ... yes , no text were not visible ...
> 
> i try change the background color of QMessageBox .. but QPalette and 
> StyleSheet is not working ... please help ...
> how to set backgroud color or color of the text in 
> QMessage::standardButton()  ..
> 
> WAGMARE
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest




More information about the Qt-interest-old mailing list