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

猜你喜欢

转载自www.cnblogs.com/sggggr/p/12671651.html