《Qt5+报错"Could not parse stylesheet of object 0x14e70758"》

版权声明:本文为博主原创文章,未经博主允许不得转载,博客地址:http://blog.csdn.net/mars_xiaolei。 https://blog.csdn.net/mars_xiaolei/article/details/85111948

出现问题 

报错代码:

ui->labelExperStatus->setStyleSheet("{color: black;font: 9pt 微软雅黑;}");

“Could not parse stylesheet of object 0x14e70758”

意思是:不能解析对象0x14e70758处的样式表

 

问题原因

使用样式表美化Qt控件时,语法错误,缺少控件类名

 

解决方法

ui->labelExperStatus->setStyleSheet("{color: black;font: 9pt 微软雅黑;}");

修改为:

ui->labelExperStatus->setStyleSheet("QLabel{color: black;font: 9pt 微软雅黑;}");

 

 

猜你喜欢

转载自blog.csdn.net/mars_xiaolei/article/details/85111948