tags:

views:

421

answers:

1

Hello,

I would like to display editors for all cells in a row when a user begins editing any cell in a QTableView. I have made several attempts but I cannot obtain the correct behaviour.

  • The only way to open multiple editors is by QAbstractItemView::openPersistentEditor() - attempts to successively call QAbstractItemView::edit() results in only one editor.
  • I cannot use signals such as clicked() and doubleClicked() from QAbstractItemView to invoke editing, because then it would not respect the edit triggers of the view.
  • There appears to be no "editing complete" signal. I would like to connect this signal to a slot that calls closePersistentEditor() for cells in the editing row.

Any suggestions would be appreciated.

Thanks!

+1  A: 

I hate to be the bearer of bad news, but I can't think of any easy way to do what you want. I can think of a couple of options, each more painful than the last:

  • You could create a delegate that always shows the editors, and when the user changes the selected row, set that delegate for the newly selected row, and the original delegate for the deselected row.
  • You could try inheriting from the table view, and overriding the behavior for drawing the appropriate items for everything in the given row. I have no idea how hard this would be, but I doubt it would be trivial.
  • You could create your own view to display the model. I've never done this, and I'd hate to think about all that would be required to "complete" support the models. However, to match with one specific model, you might be able to get away with it.
Caleb Huitt - cjhuitt