且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

未应用嵌套自定义小部件的样式表

更新时间:2022-12-11 20:22:55

QWidget 子类默认会忽略样式表(出于性能原因).

A QWidget subclass will ignore stylesheets by default (for performance reasons).

试试这个:

w = Canvas(outer)
w.setAttribute(QtCore.Qt.WA_StyledBackground)
w.setStyleSheet("background-color: black")