Fix display name of asset param

parent 248f3a5b
......@@ -89,6 +89,8 @@ AssetParameterModel::AssetParameterModel(Mlt::Properties *asset, const QDomEleme
currentRow.type = paramTypeFromStr(type);
currentRow.xml = currentParameter;
currentRow.value = value;
QString title = currentParameter.firstChildElement(QStringLiteral("name")).text();
currentRow.name = title.isEmpty() ? name : title;
m_params[name] = currentRow;
m_rows.push_back(name);
}
......@@ -135,6 +137,7 @@ QVariant AssetParameterModel::data(const QModelIndex &index, int role) const
switch (role) {
case Qt::DisplayRole:
case Qt::EditRole:
return m_params.at(paramName).name;
case NameRole:
return paramName;
case TypeRole:
......@@ -187,7 +190,7 @@ int AssetParameterModel::rowCount(const QModelIndex &parent) const
// static
ParamType AssetParameterModel::paramTypeFromStr(const QString &type)
{
if (type == QLatin1String("double") || type == QLatin1String("constant")) {
if (type == QLatin1String("double") || type == QLatin1String("float") ||type == QLatin1String("constant")) {
return ParamType::Double;
}
if (type == QLatin1String("list")) {
......
......@@ -130,6 +130,7 @@ protected:
ParamType type;
QDomElement xml;
QVariant value;
QString name;
};
QDomElement m_xml;
......
......@@ -36,7 +36,7 @@ BoolParamWidget::BoolParamWidget(std::shared_ptr<AssetParameterModel> model, QMo
m_widgetComment->setHidden(true);
// setup the name
m_labelName->setText(name);
m_labelName->setText(m_model->data(m_index, Qt::DisplayRole).toString());
// set check state
m_checkBox->setChecked(checked);
......
......@@ -39,7 +39,7 @@ ListParamWidget::ListParamWidget(std::shared_ptr<AssetParameterModel> model, QMo
m_widgetComment->setHidden(true);
m_list->setIconSize(QSize(50, 30));
// setup the name
m_labelName->setText(name);
m_labelName->setText(m_model->data(m_index, Qt::DisplayRole).toString());
slotRefresh();
// emit the signal of the base class when appropriate
......
Markdown is supported
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