Fix knobs not updating vals on link (#4904)

This commit is contained in:
Johannes Lorenz
2019-12-07 22:33:37 +01:00
committed by Johannes Lorenz
parent 534d7ca9c5
commit a0f4e50805
4 changed files with 84 additions and 0 deletions

View File

@@ -443,8 +443,23 @@ void AutomatableModel::unlinkModel( AutomatableModel* model )
void AutomatableModel::linkModels( AutomatableModel* model1, AutomatableModel* model2 )
{
if (!model1->m_linkedModels.contains( model2 ) && model1 != model2)
{
// copy data
model1->m_value = model2->m_value;
if (model1->valueBuffer() && model2->valueBuffer())
{
std::copy_n(model2->valueBuffer()->data(),
model1->valueBuffer()->length(),
model1->valueBuffer()->data());
}
// send dataChanged() before linking (because linking will
// connect the two dataChanged() signals)
emit model1->dataChanged();
// finally: link the models
model1->linkModel( model2 );
model2->linkModel( model1 );
}
}