Detecting Enter in an editable QComboBox
I have an editable QComboBox with an InsertAtCurrent insert policy. The trouble is that unless the user explicitly presses Enter, the new text the user has entered does not permanently change the text associated with the currentIndex. This makes sense actually but often times a user will enter the new text and simply left-click onto another widget, mistakenly assuming that the text they have just entered is set, only to find out later that it has not.
Q1: Is there an easy way that I can detect when a user has left-clicked off of the QComboBox widget so that I can programmatically set the text entered by the user (and emulate an Enter command)?
Q2: There is no editFinished signal available (by default) for the QComboBox widget. Can I create my own? If so, how?
Thanks!
Re: Detecting Enter in an editable QComboBox
take a look at QComoBobx::lineEdit, but there is important note
Code:
Only editable combo boxes have a line edit.
then if your combobox is editable you can simply catch lineedit's returnPressed or editingFinished signals.
Re: Detecting Enter in an editable QComboBox
Worked like a charm Spirit! Thanks much for your help.