假设当前名为Workspace
的窗口上,水平布局了两个面板PanelLeft
和PanelRight
。通常情况下,设置Workspace
的背景色,PanelLeft
和PanelRight
会继承这一属性。
在使用外部样式文件的情况下,如果不希望发生这种继承关系,可以这样处理:
第一步:在外部QSS文件
中设置Workspace
的背景色
#Workspace {
background - color: gainsboro;
}
第二步:在代码
中设置PanelLeft
和PanelRight
的背景填充属性
PanelLeft->setAutoFillBackground(true);
PanelRight->setAutoFillBackground(true);