How I remove content of data from a row in PySide2 without deleting the row
-
Hi,
Which widget are you using ?
Which model are you using ? -
@eyllanesc Rather than recreating items all the time just empty the content of the ones already existing.
for column in range(your_tablewidget.columnCount()): your_tablewidget.item(row, column).setText("")
-
@SGaist thank you, but can you tell me if I have one table in that I have some data and one delete button and also I have one more table with the same content but I select the only first table of the row which have delete button when I click on delete button data should delete both tables
-
If you are showing the exact same content on several widget then you should rather go with a QTableView and share a QStandardItemModel between the two. If you want to stay with QTableWidget then you have to do the synchronisation yourself.
-
@yashi95
Look at:
https://doc.qt.io/qt-5/qtablewidget.html#item
https://doc.qt.io/qt-5/qtablewidget.html#itemFromIndex
https://doc.qt.io/qt-5/qtablewidget.html#findItems
https://doc.qt.io/qt-5/qtablewidget.html#indexFromItemDepending on what you have/what you want map to, any of these may be relevant.