Spreadsheet: Prevent marking a cell dirty when the content didn't change

This commit is contained in:
Chris Hennes
2021-11-03 19:16:31 -05:00
parent e43189fc48
commit bcab6b5a31

View File

@@ -547,6 +547,16 @@ bool SheetModel::setData(const QModelIndex & index, const QVariant & value, int
try {
QString str = value.toString();
// Check to see if this is already the value in the cell, and skip the update if so
auto cell = sheet->getCell(address);
if (cell) {
std::string oldContent;
cell->getStringContent(oldContent);
if (str == QString::fromStdString(oldContent))
return true;
}
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Edit cell"));
// Because of possible complication of recursively escaped
// characters, let's take a shortcut and bypass the command