Dynamically resize rows in QTableView based on the delegate's editor size
I'm using a QTableView with a custom QStyledItemDelegate that uses QTextEdits for display and editing. I have reimplemented all the necessary functions for the delegate and I have setup the resizeModes in the view so when I insert or remove text in the editors (cells) the view updates itself and resizes the rows based on their contents. But this happens after I leave the edited cell.
I would like to have the row resize dynamically while adding or removing text. Any hints how I should approach this will be appreciated.
Thanks in advance.
Allow me a gentle bump with a little more info.
I realize that I have to use signals and slots to achieve this. My confusion is what signals and slots I should use in all three classes (QTextEdit, QStyledItemDelegate, and QTableView) to do the work. Currently, in the custom QTextEdit class I have connected the textChanged() signal to a custom slot that resizes the QTextEdit as text is added or removed. This indeed works in the table view but the row doesn't resize automatically too so, while editing a cell, the QTextEdit overlaps to the next row. After I leave the edited cell, the row resizes properly.
I suppose I will have to connect a signal from the delegate to the resizeRowToContents(int) slot in the QTableView and that's where I could use some help.