Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QTableView item update: when underlying model is effectively updated ?
Andrea_Benetton last edited by Andrea_Benetton
I see that in my application (Windows as OS, QT 5.15) the QStandardItemModel :: dataChanged event is raised only if I complete the cell editing with a "return" or by clicking with the mouse on another cell of the QTableView. If I go directly to the menu of my application, the QAction method is executed first and then the method connected to the dataChanged is called. Is it possible to modify this behavior by setting a property of the QTableView or by forcing the cell's updated status in the method called by the QAction?
JonB last edited by JonB
If I go directly to the menu of my application, the
QActionmethod is executed first and then the method connected to the
I guess this is possible, but slightly surprised, though I take your word.
So you just want the
dataChangedsignal, which comes at the end of editing, to be sent before the
Then I wouldn't do any fancy code. You just want to swap the order of these signals, then your code will work. There are several ways of doing this. Simplest, I think, would be to make the
triggeredmenu action be
connect()ed with a
Qt::QueuedConnection. Then the slot won't be called till the event loop is hit, and presumably the
Qt::DirectConnection, will have gone through first. That's what I would try, one line code change to see where you are.
Andrea_Benetton last edited by
Thank you @JonB .
It was not a signal issue. It was the focusPolicy property of QMenuBar that the QtDesigner set by default to "NoFocus". Changing it to "ClickFocus" set the behavior correctly for my case.