I'm using Qt with Python, and I've got a mainwindow with a status bar at the bottom. I can display a message in the bar using a QLabel, and set the color of that message using something like "<font color=\"green\">In progress</font>"
for the QLabel text.
I would like to also put a temporary message in the status bar, and assign a color to that message as well. However since it's not a QLabel this time (I'm using QStatusBar::showMessage which just takes a QString) I can't change the color anymore. The tags above are not recognized and the entire string "<font color=\"green\">In progress</font>"
is shown in gray.
Does anyone have any ideas?
Unfortunately, QStatusBar::showMessage()
doesn't support rich text formatting. This was even reported as a feature request long time ago, but it seems it didn't get enough attention.
I think your best bet is to either stick with plain text messages or manipulate your existing QLabel
directly. This would require some additional work to handle temporary status changes, so it's your call to decide if it's worth the trouble.