Stylesheet for Messagebox



  • How do we apply style sheets for the default Message box. Somehow the background color as well as the text color of the QMessagebox has become white. As the result, i cannot read the text, can only see the blue ok and cancel buttons.

    the docs said

    "The messagebox-text-interaction-flags property can be used to alter the interaction with text in the message box."
    I found an example which said

    @QString tmpStyleSheet=this->styleSheet();
    this->setStyleSheet("style sheet for your QMessageBox");
    QMessageBox::information(this, "Done", "Well done!!!");
    this->setStyleSheet(tmpStyleSheet);@

    how do i change the background and the text color. ?

    This is my code.
    @QMessageBox::StandardButton msgBox;
    msgBox=QMessageBox::information(this,tr("Start checking"),tr("Set date "),QMessageBox::Ok|QMessageBox::Cancel);@

    If any one can give suggestions or the previously answered links,

    Thank you

    alfah



  • @QString tmpStyleSheet=this->styleSheet();
    this->setStyleSheet("style sheet for your QMessageBox");
    QMessageBox::information(this, "Done", "Well done!!!");
    this->setStyleSheet(tmpStyleSheet);@

    Could you please post the contents of your stylesheet?

    The example yourQtDir\examples\widgets\stylesheet may be helpful, too.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.