-3

So this time i just want to know how to get a value of QLineEdit inside the QTableWidget.

Here is my code, and i've got this error.

I know how to get value from QComboBox inside of QTableWidget, and it's work using class.object.cellWidget(int, int).currentText().

But when I try to use class.object.cellWidget(int, int).text() for get QLineEdit value, it's return error look like the image, and i can't get the value. i have no idea about qobject_cast like this link said. and i still don't understand how to using delegate. i think it will be better if someone can fix my coding, or give me a nice reference with example about this error, or give me explanation how to use delegate in QTableWidget or give me a nice reference. oh also it will be better if the example is within python because i have bad skill for reading C++ syntax.

Community
  • 1
  • 1

1 Answers1

0

At first you need to understand what your error is. The the "noneType" Object indicates that the Object you are trying yo use, does not exists yet.

The line of code that gives the cellWidget to your variable returns None. And one line later you use the .text() on a "noneType" object.

That means you do not use the self.tableWidget.cellWidget(data,1) correctly.

Here are some examples of QTableWidget and QTableWidget.cellWidget: http://nullege.com/codes/search/PyQt4.Qt.QTableWidget.cellWidget

dterpas
  • 161
  • 1
  • 1
  • 8