Ok, I have figured it out by myself. The key was looking at the comboBoxModel->data and getting the index from rows and coloumns. That's my solution:
void comboBoxDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const {
if(QComboBox *cb = qobject_cast<QComboBox*>(editor)) {
QString cbText = cb->currentText();
int vpe_index = -1;
for (int row = 0; row < comboBoxModel->rowCount() ; row++) {
if (comboBoxModel->data(comboBoxModel->index(row, 0)) == cbText){
vpe_index = comboBoxModel->data(comboBoxModel->index(row, 1)).toInt();
}
}
if (vpe_index == -1) {
qDebug() << "Index not found";
}
else {
qDebug() << "Index set: " << model->setData(index, vpe_index, Qt::EditRole);
}
} else {
QStyledItemDelegate::setModelData(editor, model, index);
}
}