我有2个小部件: 一个是背景(半透明),另一个包含其他小部件(无背景)。 QLCDNumber 就是这种小部件之一。这是可行的,其中一个好例子是:C++,Qt QMainWindow Transparent Background Example。但是,如果您需要使其半透明或降低透明度,可以尝试以下操作:// mind the last component of rgba mainwindow->setStyleSheet("QMainWindow{background-color: rgba(255, 255, 255, 127)};");