I have a QStatusBar. I have two displays in it... Longitude and Latitude. There is a specified acceptable range for each indicator where I want the text color to be green, and then red for when it falls out of range. Not sure how to go about this especially since it is 2 different indicators in the QStatusBar?
Below is an example that demonstrates how to put labels with colored text in the status bar:
[..]
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QStatusBar sb;
QLabel lbl1("Text Green");
lbl1.setStyleSheet("QLabel { color: green }");
QLabel lbl2("Text Red");
lbl2.setStyleSheet("QLabel { color: red }");
sb.addPermanentWidget(&lbl1);
sb.addPermanentWidget(&lbl2);
sb.show();
return app.exec();
}
As you can see, the text color is changing when you set the appropriate style sheet to it.