View Full Version : QComboBox separate Edit and Display values for QDataWidgetMapper

19th April 2018, 18:33
This question is hard to describe, so the title is kind of... unclear
I have two custom (non sql) models, one of them (lets name it relationModel) populates combo box has one text colum and multiple integer columns
The other model (masterModel) has one integer column that is like foreign key from one of relationModel integer columns
I created mapper for masterModel, added mapping to a combobox that i want to populate with relationModel
the combo box should display text, and on text change masterModel should be updated with "key" integer value from combobox (that is not index)
I can only setModelColum for combobox, and that is both the display value and edit value...
Simmilar thing exists with QSqlRelationalTableModel with setRelation, but with non sql model i dont have idea how to achieve this