Mercurial > hg > svcore
comparison data/model/TextModel.h @ 1804:343ef2a866a4
Implement missing TabularModel editing methods. Also made these pure in TabularModel, since almost all subclasses want them and (clearly) forgetting to implement them is a problem!
author | Chris Cannam |
---|---|
date | Mon, 14 Oct 2019 14:17:37 +0100 |
parents | baafe1bb7e51 |
children | c546429d4c2f |
comparison
equal
deleted
inserted
replaced
1803:6eb3a76c74f7 | 1804:343ef2a866a4 |
---|---|
231 auto command = new ChangeEventsCommand(getId().untyped, tr("Edit Data")); | 231 auto command = new ChangeEventsCommand(getId().untyped, tr("Edit Data")); |
232 command->remove(e0); | 232 command->remove(e0); |
233 command->add(e1); | 233 command->add(e1); |
234 return command->finish(); | 234 return command->finish(); |
235 } | 235 } |
236 | |
237 bool isEditable() const override { return true; } | |
238 | |
239 Command *getInsertRowCommand(int row) override { | |
240 if (row < 0 || row >= m_events.count()) return nullptr; | |
241 auto command = new ChangeEventsCommand(getId().untyped, | |
242 tr("Add Label")); | |
243 Event e = m_events.getEventByIndex(row); | |
244 command->add(e); | |
245 return command->finish(); | |
246 } | |
247 | |
248 Command *getRemoveRowCommand(int row) override { | |
249 if (row < 0 || row >= m_events.count()) return nullptr; | |
250 auto command = new ChangeEventsCommand(getId().untyped, | |
251 tr("Delete Label")); | |
252 Event e = m_events.getEventByIndex(row); | |
253 command->remove(e); | |
254 return command->finish(); | |
255 } | |
236 | 256 |
237 /** | 257 /** |
238 * XmlExportable methods. | 258 * XmlExportable methods. |
239 */ | 259 */ |
240 void toXml(QTextStream &out, | 260 void toXml(QTextStream &out, |