Important: Please read the Qt Code of Conduct -

QTableWidget Delete Functionality

  • I am making a custom context menu for a QTTableWidget that allows the user to select random cells and then delete the contents of every cell selected. Haven't been able to find any built in functions that return the row and col value for each cell that is selected. I was thinking what I may have to do is store all the values by using the cellClicked() signal and then when the user right clicks to delete then iterate through my lists and delete each cells contents. Haven't been able to find a similar post so im wondering whether anyone has tried this before and can point me in the right direction.

    Thank you

  • From what I'm seeing, that might be the way you have to do it. It doesn't look like using a QTableView with a QStandardModel would help either. How would you go about implementing your idea. You could subclass QTableWidget and handle the logic internally that way. The parent widget class would then be free and clear of child widget logic clutter.

Log in to reply