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

Method __init__

QTreeWidget/ParsingJson.py:32–50  ·  view source on GitHub ↗
(self, text, badge, *args, **kwargs)

Source from the content-addressed store, hash-verified

30 """自定义的item"""
31
32 def __init__(self, text, badge, *args, **kwargs):
33 super(ItemWidget, self).__init__(*args, **kwargs)
34 layout = QHBoxLayout(self)
35 layout.setContentsMargins(0, 0, 0, 0)
36 layout.addWidget(QLabel(text, self, styleSheet='color: white;'))
37 layout.addSpacerItem(QSpacerItem(
38 60, 1, QSizePolicy.Maximum, QSizePolicy.Minimum))
39 if badge and len(badge) == 2: # 后面带颜色的标签
40 layout.addWidget(QLabel(
41 badge[0], self, alignment=Qt.AlignCenter,
42 styleSheet="""min-width: 80px;
43 max-width: 80px;
44 min-height: 38px;
45 max-height: 38px;
46 color: white;
47 border:none;
48 border-radius: 4px;
49 background: %s""" % badge[1]
50 ))
51
52
53class JsonTreeWidget(QTreeWidget):

Callers 1

__init__Method · 0.45

Calls 1

addWidgetMethod · 0.80

Tested by

no test coverage detected