def __init__(self):
QWidget.__init__(self, flags=Qt.Widget)
self.setWindowTitle("ItemView QListView")
self.setFixedWidth(310)
self.setFixedHeight(200)
data = [
{"type": "Sword", "objects": ["Long Sword", "Short Sword"], "picture": "sword.png"},
{"type": "Shield", "objects": ["Wood Shield", "iron Shied"], "picture": "shield.png"},
]
self.layout = QBoxLayout(QBoxLayout.LeftToRight, self)
self.setLayout(self.layout)
# QTreeView ?? ? ??
view = QTreeView(self)
view.setEditTriggers(QAbstractItemView.DoubleClicked)
self.model = Model(data)
view.setModel(self.model)
self.layout.addWidget(view)
# ??? ?? QLabel ??
self.lb = QLabel()
self.lb.setFixedSize(50, 50)
self.layout.addWidget(self.lb)
# ? ??? ???? ???
# ?? ???? QModelIndex? ????.
view.clicked.connect(self.slot_show_picture)
ItemViews_QTreeView_02_signal_slot.py 文件源码
python
阅读 26
收藏 0
点赞 0
评论 0
评论列表
文章目录