Making a combobox displaying a relational field of a QSqlRelationalTableModel editable, causes the combobox's QLineEdit to display the EditRole (ID field) instead of the DisplayRole.
I think there is some fundamental issue related to this: QSqlRelationalTableModel::data(*, Qt::EditRole) initially (i.e. directly after select()) returns the display value, while it returns the edit value after the first edit. This is inconsistent and doesn't comply to the documentation, which states that the EditRole should indeed return the value of the original table - not the referenced one.
This causes the model to become dirty when the very same combobox item has been selected, even though nothing has changed.
Additionally, after editing, an editor will display the wrong value.
I think, QSqlRelationalDelegate should always fetch the DisplayValue in setEditorData().
The problem can be easily reproduced using the book example:
http://doc.qt.io/qt-5/qtsql-books-example.html, making e.g. the author combobox editable.
Attached is a quick hack to the QSqlRelationalDelegate. However, as said, I think the problem is more fundamental.