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

Method onItemClicked

QScrollArea/QQSettingPanel.py:46–56  ·  view source on GitHub ↗

左侧item

(self, item)

Source from the content-addressed store, hash-verified

44 return
45
46 def onItemClicked(self, item):
47 """左侧item"""
48 row = self.listWidget.row(item) # 获取点击的item的索引
49 # 由于右侧的widget是按照命名widget_0 widget_1这样比较规范的方法,可以通过getattr找到
50 widget = getattr(self, 'widget_%d' % row, None)
51 if not widget:
52 return
53 # 定位右侧位置并滚动
54 self._blockSignals = True
55 self.scrollArea.verticalScrollBar().setSliderPosition(widget.pos().y())
56 self._blockSignals = False
57
58
59if __name__ == '__main__':

Callers

nothing calls this directly

Calls 1

yMethod · 0.80

Tested by

no test coverage detected