Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在QT上设置主窗口背景透明?我需要属性还是样式? 我试过设置不透明度,但它对我不起作用。
app.setStyleSheet("QMainWindow {opacity:0}")
您必须为 MainWindow 对象设置新属性,如下所示:
class Main(QtGui.QMainWindow): def __init__(self): self.setAttribute(Qt.WA_TranslucentBackground)
只需使用该windowOpacity属性:
windowOpacity
http://doc.qt.io/qt-4.8/qwidget.html#windowOpacity-prop