[PySide] how to close editor for combobox delegate when popup closes

Frank Rueter frank at ohufx.com
Thu Sep 1 05:31:35 CEST 2022


Hi all,

first of all thanks for the replies on my previous questions. I will get
back to those as soon as possible.
Right now I am struggling with a combobox delegate in a table widget.
When I open it then click somewhere away from it, the combobox' popup
closes as expected, but the delegate editor itself won't close (i.e. the
combobox remains visible in the cell), so subsequent clicks yield
unexpected behaviour.
I have tried to reimplement the combobox' hidePopup() method to
compare current and previous values, and if the values match just close the
editor, otherwise commit the current value before closing.
However, it seems that when the hidePopup method is run, the combobox data
has not been committed to it's own model yet, so when I check for
self.currentText() or self.currentIndex() it's not the one that was just
chosen but rather the previous one.
I might be barking up the wrong tree though?

So in a nutshell:
When using a QComboBox as a elegate for a QTableWidget, how can I close the
editor when the combobox' popup closes by losing focus?

Cheers,
frank
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20220901/31c3c417/attachment.htm>


More information about the PySide mailing list