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

Class CtComboBox

QComboBox/Lib/CtComboBox.py:71–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69
70
71class CtComboBox(QComboBox):
72
73 def __init__(self, *args, **kwargs):
74 super(CtComboBox, self).__init__(*args, **kwargs)
75 # 绑定每个元素添加信号,用于设置文本居中
76 self.model().rowsInserted.connect(self._onRowsInserted)
77 self.setStyle(ComboBoxStyle())
78
79 def _onRowsInserted(self, index, first, last):
80 if first < 0:
81 return
82 for i in range(first, last + 1):
83 self.view().model().item(i).setTextAlignment(Qt.AlignCenter)

Callers 1

__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected