Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Fix parameters with factor incorrectly handled

parent 08ace167
......@@ -259,10 +259,11 @@ void KeyframeWidget::addParameter(const QPersistentModelIndex &index)
double defaultValue = locale.toDouble(m_model->data(index, AssetParameterModel::DefaultRole).toString());
int decimals = m_model->data(index, AssetParameterModel::DecimalsRole).toInt();
double factor = m_model->data(index, AssetParameterModel::FactorRole).toDouble();
auto doubleWidget = new DoubleWidget(name, value, min, max, defaultValue, comment, -1, suffix, decimals, this);
factor = factor == 0 ? 1 : factor;
auto doubleWidget = new DoubleWidget(name, value * factor, min, max, defaultValue, comment, -1, suffix, decimals, this);
doubleWidget->factor = factor;
connect(doubleWidget, &DoubleWidget::valueChanged,
[this, index](double v) { m_keyframes->updateKeyframe(GenTime(getPosition(), pCore->getCurrentFps()), QVariant(v), index); });
[this, index, factor](double v) { m_keyframes->updateKeyframe(GenTime(getPosition(), pCore->getCurrentFps()), QVariant(v), index); });
paramWidget = doubleWidget;
}
if (paramWidget) {
......
......@@ -65,7 +65,7 @@ void DoubleWidget::setSpinSize(int width)
void DoubleWidget::setValue(double value)
{
m_dragVal->blockSignals(true);
m_dragVal->setValue(value);
m_dragVal->setValue(value * factor);
m_dragVal->blockSignals(false);
}
......@@ -77,7 +77,7 @@ void DoubleWidget::enableEdit(bool enable)
void DoubleWidget::slotSetValue(double value, bool final)
{
if (final) {
emit valueChanged(value);
emit valueChanged(value / factor);
}
}
......
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