Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Setting Focus On Table Delegate's Item With Single Click



  • I have a QTreeView. One of the columns in the QTreeView uses a QTableView as it's delegate for editing. For the most part it works. The only issue is that I have to click the treeview so that the table view editor is created. Once the table is created the focus falls on item(0,0). So then I have to click again to the table item (which, from a user point of view, was already clicked).

    I don't know if I need to install an event filter, manually send an event or what. Any help would be appreciated.



  • For the record, I did get this to work. What I did might be heretical or horrible. In a nutshell, I reimplemented editorEvent() and eventFilter() to deal with the mouse click position and set the proper model index for the table view delegate.


Log in to reply