QWidget设置背景颜色

如果widget是子窗口首先要添加一句:

 this->setAttribute(Qt::WA_StyledBackground,true);
this->setStyleSheet("background-color: rgb(255,255, 255)");

这样就可以脱离父窗口的样式

猜你喜欢

转载自www.cnblogs.com/wanghuixi/p/9035713.html
今日推荐