按名称查找QTableWidget项目的列/行

时间:2014-05-24 20:49:22

标签: python qt pyside

我尝试找到QtableWidget标题单元格的列,如下所示

column = QtCore.QObject.findChild(mytableWidget, unicode("NAME")).column() # it should retruns 0

其中mytableWidget是已定义的表

    self.mytableWidget = QtGui.QTableWidget(self.frame)
    ...
    ...
    item = QtGui.QTableWidgetItem("NAME")
    self.mytableWidget.setHorizontalHeaderItem(0, item) # searching this item

但是我收到以下错误

TypeError: 'PySide.QtCore.QObject.findChild' called with wrong argument types:
  PySide.QtCore.QObject.findChild(unicode)
Supported signatures:
  PySide.QtCore.QObject.findChild(PyTypeObject, unicode = QString())

0 个答案:

没有答案