I am writing a Python compatible syntax, but the concept should work for C++ too.
comboBox.setEditable(True)
comboBox.lineEdit().setAlignment(Qt.AlignCenter)
comboBox.lineEdit().setReadOnly(True)
Idea is, to make it editable, but setting lineEdit
inside QComboBox
as read-only later.