16,211
社区成员
发帖
与我相关
我的任务
分享
QLabel *temp_lb = new QLabel("Test", this);
temp_lb->setContentsMargins(9, 0, 9, 0);
temp_lb->setAutoFillBackground(true);
QPalette palette;
palette.setColor(QPalette::WindowText, QColor("#DAE6FF"));
temp_lb->setPalette(palette);
看下有没有在对父控件setStyleSheet设置样式时,其中设置了QLabel的样式
您好你解决该问题了吗
QLabel *temp_lb = new QLabel("Test", this);
temp_lb->setContentsMargins(9, 0, 9, 0);
temp_lb->setAutoFillBackground(true);
QPalette palette;
palette.setColor(QPalette::WindowText, QColor("#DAE6FF"));
temp_lb->setPalette(palette);
qDebug() << temp_lb->palette().windowText().color();
设置以后,把颜色打印出来是对的,但显示就始终是黑色...