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

Method __init__

QComboBox/CenterText.py:26–46  ·  view source on GitHub ↗
(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

24class Window(QWidget):
25
26 def __init__(self, *args, **kwargs):
27 super(Window, self).__init__(*args, **kwargs)
28 layout = QVBoxLayout(self)
29
30 c1 = CtComboBox(self)
31 c1.addItems(['item-%s' % i for i in range(10)])
32 layout.addWidget(c1)
33
34 # 可编辑
35 c2 = CtComboBox(self)
36 c2.setEditable(True)
37 c2.lineEdit().setAlignment(Qt.AlignCenter)
38 c2.addItems(['item-%s' % i for i in range(10)])
39 layout.addWidget(c2)
40
41 # 带图标
42 c3 = CtComboBox(self)
43 for i in range(10):
44 c3.addItem(c3.style().standardIcon(QStyle.SP_ComputerIcon),
45 'item-%s' % i)
46 layout.addWidget(c3)
47
48
49if __name__ == '__main__':

Callers

nothing calls this directly

Calls 3

CtComboBoxClass · 0.90
addWidgetMethod · 0.80
addItemMethod · 0.45

Tested by

no test coverage detected