Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Stylesheet for Messagebox
Qt 6.11 is out! See what's new in the release blog

Stylesheet for Messagebox

Scheduled Pinned Locked Moved Mobile and Embedded
2 Posts 2 Posters 7.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    alfah
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • jensen82J Offline
      jensen82J Offline
      jensen82
      wrote on last edited by
      #2

      @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.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved