Solved How I remove all data from a row in PySide2 without deleting the row
-
Ok thanks I will try that, and how I set it to no value is by doing this ```
window.tableWidget.setItem(0,0 ,QTableWidgetItem())
as you can see QTablewWidgetItem is blank and there is no value in the parenthesis
-
@jsulm wait I dont get it plus isn't that c++ docs
-
@BlueBreezy said in How I remove all data from a row in PySide2 without deleting the row:
isn't that c++ docs
It is, but it is the same interface in Python but with Python syntax...
-
@jsulm So can the same be found here https://doc.qt.io/qtforpython/PySide2/QtWidgets/QTableWidget.html
also its just
QTableWidget::item(int row, int column) const
so how would I go about deleting a row with just that?
-
@BlueBreezy said in How I remove all data from a row in PySide2 without deleting the row:
deleting a row with just that?
You don't want to delete a row, right? You want to remove the content in all cells in a row if I understood you correctly. Using item(...) you get the item in the given cell and can then reset its content. For example if you have text in an item you can use https://doc.qt.io/qt-5/qtablewidgetitem.html#setText to set empty string in it.
-
oh okay I get you sorry I got confused im not deleting the row but let me see
-
@jsulm but I think I tried setting the row no no value before but whenever my code tries to put data into it it skips the row because it thinks that there is data there, here's an example
window.tableWidget.setItem(0,0 ,QTableWidgetItem())
-
@BlueBreezy I did not suggest to call setData. I suggested to call
window.tableWidget.item(row, col).setText("");
-
@jsulm oh right okay Let me try that
-
Thanks for the help let me just check my code to see if it my fault