Spreadsheet: Improve python code when the Delete key is pressed.

This commit is contained in:
Eivind Kvedalen
2015-11-07 22:21:28 +01:00
committed by wmayer
parent 127442be75
commit 5d562c26bc

View File

@@ -36,6 +36,7 @@
#include "SpreadsheetView.h"
#include <Mod/Spreadsheet/App/Sheet.h>
#include <Mod/Spreadsheet/App/Range.h>
#include <App/Document.h>
#include <Gui/BitmapFactory.h>
#include <Gui/Application.h>
@@ -157,10 +158,12 @@ bool ViewProviderSheet::onDelete(const std::vector<std::string> &)
if (selection.size() > 0) {
Gui::Command::openCommand("Clear cell(s)");
for (QModelIndexList::const_iterator it = selection.begin(); it != selection.end(); ++it) {
std::string address = CellAddress((*it).row(), (*it).column()).toString();
std::vector<Range> ranges = sheetView->selectedRanges();
std::vector<Range>::const_iterator i = ranges.begin();
for (; i != ranges.end(); ++i) {
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.clear('%s')", sheet->getNameInDocument(),
address.c_str());
i->rangeString().c_str());
}
Gui::Command::commitCommand();
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.recompute()");