QTableView Editor closes after losing focus
-
Dear friends,
I have a QTableview which have components on the cell like QLineEdit ,QComboBox, QCheckBox. So What I actually i wanted to do achieve like suppose i am entering some values in my QLineEdit then the editor is open after that I press Alt+Tab to open another application.when i came back on the QLineEdit(table) then the editor is close so i can not write any more untill unless i click the QlineEdit again.
So basicly i want to achieve that QTableView should work like Excel works.When We switch using ALT+Tab and again i came back on QLineEdit the editor should be open and i can write until unless i move to the next cell.
Please suggest me some ideas how can we achieve this or some example or some link .
Thanks in Advance -
@Sebastian
by default the editor is closed on focus-out.
To overcome this, you can subclass QStyledItemDelegate and reimplement editorEvent() and simply return true in case of an focusout event. -
@raven-worx
i have a class inherited from QStyledItemDelegate and re implemented the editorEvent() and return the true when event type is focus out. My problem is now like when we press the ALT+Tab and change to the another application.In that case focus out event never comes. I tried to find the reason may be the editor is deleted.Is there anyway should i try ???
-
@Sebastian
also filter the TAB/BACKTAB key press events.
See this -> check every case where the closeEditor() signal is emitted.