Spreadsheet: Improve python code when the Delete key is pressed.
This commit is contained in:
parent
8b745b3751
commit
45a2207f81
|
@ -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()");
|
||||
|
|
Loading…
Reference in New Issue
Block a user