QWidget* TankInfoDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const { // ncreate editor needs to be called before because it will populate a few // things in the currCombo global var. QWidget *delegate = ComboBoxDelegate::createEditor(parent, option, index); CylindersModel *mymodel = qobject_cast<CylindersModel *>(currCombo.model); cylinder_t *cyl = mymodel->cylinderAt(index); currCylinderData.type = cyl->type.description; currCylinderData.pressure = cyl->type.workingpressure.mbar; currCylinderData.size = cyl->type.size.mliter; return delegate; }