Frage

i have an editable row in my tablewidget. The values are from a .txt. My intension is it to change some Values in the widget, and then make a new .txt with the changed Values. but i dont know how to "extract" the changed Values from the widget.

with

item=self.model.item(1,1)
iteml.append(item)
print(iteml)

I only get:

[<PyQt4.QtGui.QStandardItem object at 0x02DD2A98>]

But I don't want the memory address but the Value. Any Ideas?

War es hilfreich?

Lösung

Adding on top of Mailerdaimon: If you want the string as a python string instead of a PyQt4.QtCore.QString object, you can simply use

item=self.model.item(1,1)
thestring = str(item.text())

(Sorry, I would have posted a comment, but I'm not allowed since I don't have 50 rep.)

Andere Tipps

Use:

item=self.model.item(1,1)
item.text()

to get the Text Value of the QTableWidgetItem

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top