[SOLVED] QStatusBar Background Color



  • All I have been doing some searching around and some attempts to change the background color of the Status bar at the bottom of the main window. Basically as I connect and disconnect from another networked system I want to display red for disconnected and green for connected. I was able to change the font color ok but what I really want to is the entire bar to be green or red. Here is what I have tried.

    @
    ui->statusBar->setStyleSheet("{background-color:rgb(0, 255, 0);");
    @

    Any ideas? This does not work



  • If you are using a custom widget you need to overload the PaintEvent specifically you should have a look at drawPrimitive. Creating a custom widget with a custom paint event should solve your problem, of not being able to use some of QSS's features.


  • Moderators

    Loose the {
    @
    ui->statusBar->setStyleSheet("background-color: rgb(0, 255, 0);");
    @



  • Perfect thank you Chris!


Log in to reply
 

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