[education/rkward] rkward/dataeditor: Slightly better efficiency when pasting data into table editor

Thomas Friedrichsmeier null at kde.org
Thu May 26 10:06:45 BST 2022


Git commit eb497ac7503f681601bc116f20ce1e4bf016e382 by Thomas Friedrichsmeier.
Committed on 22/05/2022 at 20:09.
Pushed by tfry into branch 'master'.

Slightly better efficiency when pasting data into table editor

M  +9    -0    rkward/dataeditor/rkvareditmodel.cpp

https://invent.kde.org/education/rkward/commit/eb497ac7503f681601bc116f20ce1e4bf016e382

diff --git a/rkward/dataeditor/rkvareditmodel.cpp b/rkward/dataeditor/rkvareditmodel.cpp
index 657736bb..2af5b972 100644
--- a/rkward/dataeditor/rkvareditmodel.cpp
+++ b/rkward/dataeditor/rkvareditmodel.cpp
@@ -440,6 +440,11 @@ void RKVarEditModel::setTextMatrix (const QModelIndex& offset, const RKTextMatri
 // TODO: some models might not support column addition.
 	if (right >= trueCols ()) doInsertColumns (objects.size (), right - trueCols () + 1);
 	RK_ASSERT (right < trueCols ());
+
+	for (int i = left; i < right; ++i) {
+		objects[i]->lockSyncing(true);
+	}
+
 	int current_rows = objects[0]->getLength ();
 	if (bottom >= current_rows) insertRows (current_rows, bottom - current_rows + 1);
 
@@ -453,6 +458,10 @@ void RKVarEditModel::setTextMatrix (const QModelIndex& offset, const RKTextMatri
 		}
 		++tcol;
 	}
+
+	for (int i = left; i < right; ++i) {
+		objects[i]->lockSyncing(false);
+	}
 }
 
 void RKVarEditModel::restoreObject (RObject* object, RCommandChain* chain) {



More information about the rkward-tracker mailing list