QLabel设置字体颜色

(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

posted @ 2020-04-10 10:16  sgggr  阅读(2641)  评论(0编辑  收藏  举报