There are two tables: Warehouse and Ingredients, interconnected by a foreign key by id . Arranged ComboBoxDelegate in QTableView . ComboBox takes data from the Warehouse table in the Weight column. But there is such a moment that it displays the entire column completely, and I need each row to have a choice of "weight" for the corresponding ID. At the moment, the status of the code is as follows:
ComboBoxDelegate::ComboBoxDelegate(QObject *parent) { DelegateModel = new QSqlQueryModel; DelegateModel->setQuery("SELECT weight FROM sklad, ingridient WHERE sklad.idsklad=ingridient.iding;"); } QWidget *ComboBoxDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &/* option */, const QModelIndex &/* index */) const { QComboBox *editor = new QComboBox(parent); editor->setModel(DelegateModel); return editor; } Tell me who can do it, but already Moscow has broken how to do it.

