MCPcopy
hub / github.com/PyQt5/PyQt / __init__

Method __init__

Demo/NewFramelessWindow.py:137–151  ·  view source on GitHub ↗
(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

135class FramelessWindow(QWidget, Ui_FormFrameless):
136
137 def __init__(self, *args, **kwargs):
138 super(FramelessWindow, self).__init__(*args, **kwargs)
139 self.setupUi(self)
140 # 无边框
141 self.setWindowFlags(self.windowFlags() | Qt.FramelessWindowHint)
142 self.setAttribute(Qt.WA_TranslucentBackground, True)
143 self.setMouseTracking(True)
144 # 隐藏还原按钮
145 self.buttonNormal.setVisible(False)
146 # 标题栏按钮信号
147 self.buttonMinimum.clicked.connect(self.showMinimized)
148 self.buttonMaximum.clicked.connect(self.showMaximized)
149 self.buttonNormal.clicked.connect(self.showNormal)
150 self.buttonClose.clicked.connect(self.close)
151 self.setStyleSheet('#widgetTitleBar{background: rgb(232, 232, 232);}')
152
153 def showMinimized(self):
154 flags = self.windowFlags()

Callers

nothing calls this directly

Calls 1

setupUiMethod · 0.45

Tested by

no test coverage detected