我正在使用Qt Designer来管理大型UI和代码的Pyside。我想在我的桌子上显示一个组合框。
以下答案给出了有关如何亲自管理UI时如何完成此操作的详细说明: PyQt-如何使用QItemDelegate在表视图中设置QComboBox
我的问题是:当pyside-uic已经为我创建UI时,该如何工作?链接中的代码或多或少包括:
class TableView(QtGui.QTableView):
def __init__(self, *args, **kwargs):
QtGui.QTableView.__init__(self, *args, **kwargs)
# Set the delegate for column 0 of our table
self.setItemDelegateForColumn(0, ComboDelegate(self))
[...]
class Widget(QtGui.QWidget):
self._tm=TableModel(self)
self._tv=TableView(self)
self._tv.setModel(self._tm)
Run Code Online (Sandbox Code Playgroud)
Does this mean that if I have a UI file, I still need to write out, then call something like the TableView object myself? Should I create a TableView in Qt Designer, then overwrite it with one I've created that inherits from QTableView and adds setItemDelegate?
Thanks in …