[英]PyQT: Creating custom Widgets for QListView
I want to add a custom Widget to the QListView, i read already the SO thread about Delegates. 我想向QListView添加自定义窗口小部件,我已经阅读了有关委托的SO线程。 QListView/QListWidget with custom items and custom item widgets
QListView / QListWidget与自定义项目和自定义项目小部件
But how is this applied in pyqt? 但是如何在pyqt中应用呢? i couldn't find any example.
我找不到任何例子。 Some articles show how to overwrite the paint function, which will only change the appearance but not add a widget as an item.
一些文章展示了如何覆盖绘画功能,该功能只会改变外观,而不会将小部件添加为项目。
setCellWidget() if you can switch to QListWidget or QTableWidget add custom widget to QTableWidget cell setCellWidget(),如果可以切换到QListWidget或QTableWidget, 则将自定义窗口小部件添加到QTableWidget单元格
...or you can just spawn new Widget in a cell rectangle via delegate like I do here: delegate that edits bound python object properties ...或者您可以像我在这里一样通过委托在单元格矩形中生成新的Widget: 编辑绑定的python对象属性的委托
We used code like this to handle text, number, date, boolean, image, document file, coordinate, list properties etc of our domain objects. 我们使用这样的代码来处理域对象的文本,数字,日期,布尔值,图像,文档文件,坐标,列表属性等。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.