Mercurial > hg > svcore
comparison data/model/NoteModel.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 | ee3b248bda25 |
comparison
equal
deleted
inserted
replaced
1803:6eb3a76c74f7 | 1804:343ef2a866a4 |
---|---|
320 { | 320 { |
321 if (column == 5) return SortAlphabetical; | 321 if (column == 5) return SortAlphabetical; |
322 return SortNumeric; | 322 return SortNumeric; |
323 } | 323 } |
324 | 324 |
325 bool isEditable() const override { return true; } | |
326 | |
327 Command *getInsertRowCommand(int row) override { | |
328 if (row < 0 || row >= m_events.count()) return nullptr; | |
329 auto command = new ChangeEventsCommand(getId().untyped, | |
330 tr("Add Note")); | |
331 Event e = m_events.getEventByIndex(row); | |
332 command->add(e); | |
333 return command->finish(); | |
334 } | |
335 | |
336 Command *getRemoveRowCommand(int row) override { | |
337 if (row < 0 || row >= m_events.count()) return nullptr; | |
338 auto command = new ChangeEventsCommand(getId().untyped, | |
339 tr("Delete Note")); | |
340 Event e = m_events.getEventByIndex(row); | |
341 command->remove(e); | |
342 return command->finish(); | |
343 } | |
344 | |
325 /** | 345 /** |
326 * NoteExportable methods. | 346 * NoteExportable methods. |
327 */ | 347 */ |
328 | 348 |
329 NoteList getNotes() const override { | 349 NoteList getNotes() const override { |