MCPcopy Create free account
hub / github.com/PyQt5/PyQt / CustomButton

Class CustomButton

QListWidget/FoldWidget.py:42–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40
41
42class CustomButton(QPushButton):
43 # 按钮作为开关
44
45 def __init__(self, item, *args, **kwargs):
46 super(CustomButton, self).__init__(*args, **kwargs)
47 self.item = item
48 self.setCheckable(True) # 设置可选中
49
50 def resizeEvent(self, event):
51 # 解决item的高度问题
52 super(CustomButton, self).resizeEvent(event)
53 self.item.setSizeHint(QSize(self.minimumWidth(), self.height()))
54
55
56class Window(QListWidget):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected