When QComboBox is set editable
<p>The code below creates QComboBox and QPushButton both assigned to the same layout. Combobox is set to be editable so the user is able to type a new combobox item's value. 
If the user hits <strong>Tab</strong> keyboard key (instead of Enter) the New Value will not be added to the ComboBox. 
Question: How to make sure the ComboBox's items are updated with the New Value even if the user leaves the ComboBox with <strong>Tab</strong> key?</p>

<p><a href="http://i.stack.imgur.com/wPZPN.png" rel="nofollow"><img src="http://i.stack.imgur.com/wPZPN.png" alt="enter image description here"></a></p>

<pre><code>from PyQt4 import QtGui

def comboActivated(arg=None):
    print '\n ...comboActivated: %s'%arg

widget = QtGui.QWidget()
layout = QtGui.QVBoxLayout()
widget.setLayout(layout)
combo = QtGui.QComboBox()
combo.setEditable(True)
combo.addItems(['One','Two','Three'])
combo.activated.connect(comboActivated)
layout.addWidget(combo)
layout.addWidget(QtGui.QPushButton('Push'))
widget.show()
</code></pre>

<p>When a user edits the text in the box, the <code>editTextChanged()</code> signal is emitted with the edited text as its argument. In addition, when the widget itself loses focus, as when the user types <code>Tab</code> to move to the button, the widget emits the <code>focusOutEvent()</code> signal. The argument for this signal is a <code>QFocusEvent</code>, which you can query for the reason focus was lost. The <code>reason()</code> method of the event would return <code>Qt.TabFocusReason</code>, for example, if the user hit the <code>Tab</code> button to leave the widget.</p>

<p>You can connect a slot to either (or both) of these signals, so that when the user leaves the widget after editing text, you process it and add it to the box's list of values.</p>

<p>You may also want to look into the <code>QValidator</code> class and its subclasses, which you attach to widgets with editable text, and define the types of valid input for the widget (e.g., integers, text, etc.). This is the best and easiest way to verify a user's input for editable widgets.</p>

python pyqt pyside qcombobox