Solved How to change the color of a QLabel?
-
I know this is a basic question. But I searched the net and tried many ways. None of them are working.
I tried
QPalette color;
color.setColor(QPalette::WindowText, Qt::red);ui->qLabel->setText("<font color='red'>Text</font>");
ui->qLabel->setStyleSheet("QLabel { color : red; }");
-
@MasterBlade
the last 2 approaches definitely work.
If they are not then the issue is somewhere else in your code. -
use - label.setStyleSheet("background:red");
-
I figured it out somehow by using
QPalette color;
color.setColor(QPalette::ButtonText, Qt::red);Thanks for the help!