这是原代码:状态条上灰色背景显示文字绿色,当我修改为其他颜色后还是老样,怎么办?
代码放入一个按钮响应的槽函数中
statusBar = new QStatusBar(TcyVisionUIClass);
statusBar->setObjectName(QString::fromUtf8("statusBar"));
QFont font;
font.setFamily(QString::fromUtf8("Microsoft Tai Le"));
font.setPointSize(10);
statusBar->setFont(font);
statusBar->setStyleSheet(QString::fromUtf8("color: rgb(0, 255, 0);\n"
"background-color: rgb(125, 125, 125);"));
ui.statusBar->showMessage("Tom");//显示绿色Tom,背景灰色
现在修改为:
statusBar->setStyleSheet(QString::fromUtf8("color: rgb(255, 0, 0);\n"
"background-color: rgb(255, 255, 255);"));
ui.statusBar->showMessage("Tom");//仍然显示绿色Tom,背景灰色,怎么办?
可以看这个 https://blog.csdn.net/qq_43627907/article/details/125677496