Mercurial > hg > svgui
diff layer/WaveformLayer.cpp @ 1471:f2525e6cbdf1 by-id
More layer updates
author | Chris Cannam |
---|---|
date | Mon, 01 Jul 2019 14:17:13 +0100 |
parents | 696e569ff21b |
children | 36ad3cdabf55 |
line wrap: on
line diff
--- a/layer/WaveformLayer.cpp Fri Jun 28 17:37:22 2019 +0100 +++ b/layer/WaveformLayer.cpp Mon Jul 01 14:17:13 2019 +0100 @@ -74,10 +74,15 @@ auto oldModel = ModelById::getAs<RangeSummarisableTimeValueModel>(m_model); auto newModel = ModelById::getAs<RangeSummarisableTimeValueModel>(modelId); - if (!newModel) { - SVCERR << "WARNING: WaveformLayer::setModel: Model is not a RangeSummarisableTimeValueModel" << endl; + if (!modelId.isNone() && !newModel) { + throw std::logic_error("Not a RangeSummarisableTimeValueModel"); } + if (m_model == modelId) return; + m_model = modelId; + + m_cacheValid = false; + bool channelsChanged = false; if (m_channel == -1) { if (!oldModel) { @@ -92,12 +97,10 @@ } } - m_model = modelId; - m_cacheValid = false; - if (!newModel || !newModel->isOK()) return; - - connectSignals(m_model); - + if (newModel) { + connectSignals(m_model); + } + emit modelReplaced(); if (channelsChanged) emit layerParametersChanged();