Show editors for all cells in a row in a QTableView

I would like to display editors for all cells in a row when the user starts editing any cell in QTableView. I have made several attempts, but I cannot get the correct behavior.

  • The only way to open several editors is QAbstractItemView::openPersistentEditor()to try sequential calls QAbstractItemView::edit()in only one editor.
  • I can not use signals such as clicked()and doubleClicked(), from QAbstractItemViewthat cause editing, because then he will not respect edit submission triggers.
  • It seems that there is no “editing completed” signal. I would like to connect this signal to the slot that calls closePersistentEditor()for the cells in the edit line.

Any suggestions would be appreciated.

Thanks!

+3
source share
1 answer

I hate being the bearer of bad news, but I can't come up with any easy way to do what you want. I can imagine several options, each of which is more painful than the last:

  • You can create a delegate that always displays editors, and when the user changes the selected row, set this delegate for the recently selected row and the original delegate for the selected group.
  • You can try to inherit from the table view and redefine the behavior to draw the corresponding elements for everything in a given row. I have no idea how hard it will be, but I doubt it would be trivial.
  • . , , "" . , , .
+3

Source: https://habr.com/ru/post/1706771/


All Articles