Mercurial > hg > svgui
comparison layer/TextLayer.cpp @ 1471:f2525e6cbdf1 by-id
More layer updates
author | Chris Cannam |
---|---|
date | Mon, 01 Jul 2019 14:17:13 +0100 |
parents | 696e569ff21b |
children | 36ad3cdabf55 |
comparison
equal
deleted
inserted
replaced
1470:696e569ff21b | 1471:f2525e6cbdf1 |
---|---|
50 if (model) return model->getCompletion(); | 50 if (model) return model->getCompletion(); |
51 else return 0; | 51 else return 0; |
52 } | 52 } |
53 | 53 |
54 void | 54 void |
55 TextLayer::setModel(ModelId model) | 55 TextLayer::setModel(ModelId modelId) |
56 { | 56 { |
57 if (m_model == model) return; | 57 auto newModel = ModelById::getAs<TextModel>(modelId); |
58 m_model = model; | 58 |
59 | 59 if (!modelId.isNone() && !newModel) { |
60 connectSignals(m_model); | 60 throw std::logic_error("Not a TextModel"); |
61 | 61 } |
62 // SVDEBUG << "TextLayer::setModel(" << model << ")" << endl; | 62 |
63 if (m_model == modelId) return; | |
64 m_model = modelId; | |
65 | |
66 if (newModel) { | |
67 connectSignals(m_model); | |
68 } | |
63 | 69 |
64 emit modelReplaced(); | 70 emit modelReplaced(); |
65 } | 71 } |
66 | 72 |
67 Layer::PropertyList | 73 Layer::PropertyList |