static void parse_cylinder_keyvalue(void *_cylinder, const char *key, const char *value) { cylinder_t *cylinder = _cylinder; if (!strcmp(key, "vol")) { cylinder->type.size = get_volume(value); return; } if (!strcmp(key, "workpressure")) { cylinder->type.workingpressure = get_pressure(value); return; } /* This is handled by the "get_utf8()" */ if (!strcmp(key, "description")) return; if (!strcmp(key, "o2")) { cylinder->gasmix.o2 = get_fraction(value); return; } if (!strcmp(key, "he")) { cylinder->gasmix.he = get_fraction(value); return; } if (!strcmp(key, "start")) { cylinder->start = get_pressure(value); return; } if (!strcmp(key, "end")) { cylinder->end = get_pressure(value); return; } if (!strcmp(key, "use")) { cylinder->cylinder_use = cylinderuse_from_text(value); return; } report_error("Unknown cylinder key/value pair (%s/%s)", key, value); }
void TankUseDelegate::setEditorData(QWidget * editor, const QModelIndex & index) const { QComboBox *comboBox = qobject_cast<QComboBox*>(editor); QString indexString = index.data().toString(); comboBox->setCurrentIndex(cylinderuse_from_text(indexString.toUtf8().data())); }