comparison 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
comparison
equal deleted inserted replaced
1470:696e569ff21b 1471:f2525e6cbdf1
72 } 72 }
73 73
74 void 74 void
75 FlexiNoteLayer::setModel(ModelId modelId) 75 FlexiNoteLayer::setModel(ModelId modelId)
76 { 76 {
77 auto newModel = ModelById::getAs<NoteModel>(modelId);
78
79 if (!modelId.isNone() && !newModel) {
80 throw std::logic_error("Not a NoteModel");
81 }
82
77 if (m_model == modelId) return; 83 if (m_model == modelId) return;
78
79 auto model = ModelById::getAs<NoteModel>(modelId);
80 if (!model) throw std::logic_error("Not a NoteModel");
81
82 m_model = modelId; 84 m_model = modelId;
83 85
84 connectSignals(m_model); 86 if (newModel) {
87 connectSignals(m_model);
88 }
85 89
86 emit modelReplaced(); 90 emit modelReplaced();
87 } 91 }
88 92
89 Layer::PropertyList 93 Layer::PropertyList