Nobody knows !![]()
Nobody knows !![]()
I'm not sure if I have understand your scenario.
The "external" button is not part of the editor widget? Why not make the button part of the editor? Clicking on "add" would do a validation and close the widget if the data is valid? Afair "setModelData()" is called if the editor loses his focus.
or ask a method like "isValid()" in "setModelData()" and only add the data to the model if it returns true.
To be clearer:
I have a QTreeWidget with a delegate for edition of cells.
Case 1- If the component used for edition is a QComboBox, then the edition mode is closed and the value of the QComboBox is kept when the focus is lost.
This is a standard behaviour with code needed.
Case 2- If the component used for edition is a my widget (A frame containing 3 QComboBox), then the edition mode is closed and the value of the QComboBox is NOT kept (cell is empty) when the focus is lost.
So, end user needs to validate the cell by clicking "Return".
How to get same behaviour in Case 2 than in Case 1 ?
Bookmarks