comparison data/model/ImageModel.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 13bd41bd8a17
children c546429d4c2f
comparison
equal deleted inserted replaced
1803:6eb3a76c74f7 1804:343ef2a866a4
228 auto command = new ChangeEventsCommand(getId().untyped, tr("Edit Data")); 228 auto command = new ChangeEventsCommand(getId().untyped, tr("Edit Data"));
229 command->remove(e0); 229 command->remove(e0);
230 command->add(e1); 230 command->add(e1);
231 return command->finish(); 231 return command->finish();
232 } 232 }
233
234 bool isEditable() const override { return true; }
235
236 Command *getInsertRowCommand(int row) override {
237 if (row < 0 || row >= m_events.count()) return nullptr;
238 auto command = new ChangeEventsCommand(getId().untyped,
239 tr("Add Image"));
240 Event e = m_events.getEventByIndex(row);
241 command->add(e);
242 return command->finish();
243 }
244
245 Command *getRemoveRowCommand(int row) override {
246 if (row < 0 || row >= m_events.count()) return nullptr;
247 auto command = new ChangeEventsCommand(getId().untyped,
248 tr("Delete Image"));
249 Event e = m_events.getEventByIndex(row);
250 command->remove(e);
251 return command->finish();
252 }
233 253
234 /** 254 /**
235 * XmlExportable methods. 255 * XmlExportable methods.
236 */ 256 */
237 void toXml(QTextStream &out, 257 void toXml(QTextStream &out,