QDataWidgetMapper and QComboBox
I have the classical QSqlRelationalTableModel situation where the customerModel is the master and the countryModel is the detail. The problem is that I don't want to display this model in a table, but show one record at a time in individual widgets using the QDataWidgetMapper.
How do I wire up the QComboBox that allows the user to pick the country?
Possible options:
- Make the customerModel a QSqlTableModel, pass a 3rd param to the addMapper function
- Make the customerModel a QSqlRelationalTableModel, wire up the relationship, and Qt does the rest.
- something else
Re: QDataWidgetMapper and QComboBox
Use QSqlRelationalDelegate on the widget mapper.
Re: QDataWidgetMapper and QComboBox
Ok, let me see if I understand what you mean.
- the customerModel needs to be QSqlRelationalTableModel
- Wire up the relationship to the countryModel
- Create a QDataWidgetMapper
- Make the mappers delegate the QSqlRelationalDelegate
- Add a mapping for the QComboBox
Correct?
Re: QDataWidgetMapper and QComboBox
Yes, something like that.
Re: QDataWidgetMapper and QComboBox
Tried that and it did not work :(