(1)使用樣式表(推薦)
label->setStyleSheet("QLabel{color:rgba(66, 133, 245, 255);}");
(2)使用QPalette
QLabel *label = new QLabel("Hello Qt!"); QPalette palette; palette.setColor(QPalette::WindowText, Qt::white); label->setPalette(palette);
轉載自:
https://blog.csdn.net/weixin_43742643/article/details/100171293