Mercurial > hg > svgui
diff layer/FlexiNoteLayer.cpp @ 1471:f2525e6cbdf1 by-id
More layer updates
author | Chris Cannam |
---|---|
date | Mon, 01 Jul 2019 14:17:13 +0100 |
parents | 696e569ff21b |
children | e540aa5d89cd |
line wrap: on
line diff
--- a/layer/FlexiNoteLayer.cpp Fri Jun 28 17:37:22 2019 +0100 +++ b/layer/FlexiNoteLayer.cpp Mon Jul 01 14:17:13 2019 +0100 @@ -74,14 +74,18 @@ void FlexiNoteLayer::setModel(ModelId modelId) { + auto newModel = ModelById::getAs<NoteModel>(modelId); + + if (!modelId.isNone() && !newModel) { + throw std::logic_error("Not a NoteModel"); + } + if (m_model == modelId) return; - - auto model = ModelById::getAs<NoteModel>(modelId); - if (!model) throw std::logic_error("Not a NoteModel"); - m_model = modelId; - connectSignals(m_model); + if (newModel) { + connectSignals(m_model); + } emit modelReplaced(); }