Commit f8471053 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix geometry param (like tracker) not restoring value after save

parent 92d6af69
......@@ -39,12 +39,20 @@ GeometryEditWidget::GeometryEditWidget(std::shared_ptr<AssetParameterModel> mode
const QString value = m_model->data(m_index, AssetParameterModel::ValueRole).toString().simplified();
int start = m_model->data(m_index, AssetParameterModel::ParentInRole).toInt();
int end = start + m_model->data(m_index, AssetParameterModel::ParentDurationRole).toInt();
QSize profileSize = pCore->getCurrentFrameSize();
Mlt::Properties mlt_prop;
m_model->passProperties(mlt_prop);
mlt_prop.set("rect", value.toUtf8().data());
mlt_rect r = mlt_prop.get_rect("rect");
QRect rect = QRect(int(profileSize.width() * r.x), int(profileSize.height() * r.y), int(profileSize.width()* r.w), int(profileSize.height() * r.h));;
QRect rect;
if (value.contains(QLatin1Char('%'))) {
QSize profileSize = pCore->getCurrentFrameSize();
Mlt::Properties mlt_prop;
m_model->passProperties(mlt_prop);
mlt_prop.set("rect", value.toUtf8().data());
mlt_rect r = mlt_prop.get_rect("rect");
rect = QRect(int(profileSize.width() * r.x), int(profileSize.height() * r.y), int(profileSize.width()* r.w), int(profileSize.height() * r.h));;
} else {
QStringList vals = value.split(QLatin1Char(' '));
if (vals.count() >= 4) {
rect = QRect(vals.at(0).toInt(), vals.at(1).toInt(), vals.at(2).toInt(), vals.at(3).toInt());
}
}
if (rect.isNull()) {
// Cannot read value, use random default
rect = QRect(50, 50, 200, 200);
......
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