I have QStyledDelegate which creates QComboBox editor in createEditor() method. The editor closes only when user chooses an item in the list and the presses Enter key. I want the editor to be closed only when user chooses the item. How to do this?
I've tried to use QComboBox's currentIndexChanged() signal, but it's emitted even when user just clicks the table cell to view the editor.
You need to connect QComboBox::currentIndexChanged
signal to a slot in your delegate. Inside the slot you should emit closeEditor
signal.
Initial currentIndexChanged
signal emission is most likely caused by you setting current index after creation. Just put the connect statement below setting value of the combo box.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With