changeset 1646:b429750e64a8 single-point

Command tweaks, including executing it!
author Chris Cannam
date Thu, 14 Mar 2019 13:11:47 +0000
parents 82596b4deef6
children 29a20719796e
files data/model/NoteModel.h
diffstat 1 files changed, 17 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/data/model/NoteModel.h	Thu Mar 14 13:11:30 2019 +0000
+++ b/data/model/NoteModel.h	Thu Mar 14 13:11:47 2019 +0000
@@ -192,6 +192,10 @@
             return m_name;
         }
 
+        void setName(QString name) {
+            m_name = name;
+        }
+
         void add(Event e) {
             m_add.insert(e);
         }
@@ -201,13 +205,21 @@
         }
         
         void execute() override {
-            for (const Event &e: m_add) m_model->add(e);
-            for (const Event &e: m_remove) m_model->remove(e);
+            for (const Event &e: m_add) {
+                m_model->add(e);
+            }
+            for (const Event &e: m_remove) {
+                m_model->remove(e);
+            }
         }
 
         void unexecute() override {
-            for (const Event &e: m_remove) m_model->add(e);
-            for (const Event &e: m_add) m_model->remove(e);
+            for (const Event &e: m_remove) {
+                m_model->add(e);
+            }
+            for (const Event &e: m_add) {
+                m_model->remove(e);
+            }
         }
 
         EditCommand *finish() {
@@ -215,6 +227,7 @@
                 delete this;
                 return nullptr;
             } else {
+                execute();
                 return this;
             }
         }