Commit 3c502b32 authored by Volker Krause's avatar Volker Krause
Browse files

Fix editing of schema entry types

parent 9879c594
......@@ -101,13 +101,17 @@ QVariant SchemaModel::data(const QModelIndex& index, int role) const
return {};
if (index.internalId() == TOPLEVEL) {
const auto entry = m_product.schema().at(index.row());
switch (index.column()) {
case 0:
if (role == Qt::DisplayRole || role == Qt::EditRole)
return m_product.schema().at(index.row()).name();
return entry.name();
break;
case 1:
if (role == Qt::DisplayRole)
return Util::enumToString(entry.dataType());
else if (role == Qt::EditRole)
return QVariant::fromValue(entry.dataType());
break;
}
} else {
......@@ -160,6 +164,8 @@ bool SchemaModel::setData(const QModelIndex &index, const QVariant &value, int r
case 0:
entry.setName(value.toString());
break;
case 1:
entry.setDataType(value.value<SchemaEntry::DataType>());
break;
}
} else {
......
......@@ -77,7 +77,7 @@ private:
SchemaEntryItemEditorFactory::SchemaEntryItemEditorFactory() :
m_elementModel(new AggregationElementModel)
{
registerEditor(qMetaTypeId<SchemaEntry::AggregationType>(), new QStandardItemEditorCreator<MetaEnumComboBox>());
registerEditor(qMetaTypeId<SchemaEntry::DataType>(), new QStandardItemEditorCreator<MetaEnumComboBox>());
registerEditor(qMetaTypeId<SchemaEntryElement::Type>(), new QStandardItemEditorCreator<MetaEnumComboBox>());
registerEditor(qMetaTypeId<Aggregation::Type>(), new QStandardItemEditorCreator<MetaEnumComboBox>());
registerEditor(qMetaTypeId<AggregationElement>(), new AggregationElementEditorCreator(m_elementModel.get()));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment