[TD] add missing check for leader line in ProjGroup

see https://forum.freecadweb.org/viewtopic.php?f=35&t=43115&start=10#p374279

- also uniform line endings in ViewProviderWeld.cpp
This commit is contained in:
donovaly
2020-03-06 01:11:10 +01:00
committed by WandererFan
parent c8cb520887
commit 32ef86b7ac
2 changed files with 28 additions and 20 deletions

View File

@@ -48,6 +48,7 @@
#include <Gui/SoFCSelection.h>
#include <Gui/ViewProviderDocumentObject.h>
#include <Mod/TechDraw/App/DrawLeaderLine.h>
#include <Mod/TechDraw/App/DrawProjGroupItem.h>
#include <Mod/TechDraw/App/DrawViewDetail.h>
#include <Mod/TechDraw/App/DrawViewSection.h>
@@ -180,12 +181,19 @@ bool ViewProviderProjGroup::onDelete(const std::vector<std::string> &)
ViewList.push_back(DetIterator->Label.getValue());
}
}
// get its leader lines
auto viewLead = Item->getLeaders();
if (!viewLead.empty()) {
for (auto LeadIterator : viewLead) {
ViewList.push_back(LeadIterator->Label.getValue());
}
}
}
// if there are section or detail views we cannot delete because this would break them
if (!ViewList.empty()) {
bodyMessageStream << qApp->translate("Std_Delete",
"The group cannot be deleted because its items have the\n following section and detail views that would get broken:\n");
"The group cannot be deleted because its items have the following\n section or detail views, or leader lines that would get broken:\n");
for (auto ListIterator : ViewList)
bodyMessageStream << '\n' << QString::fromUtf8(ListIterator.c_str());
QMessageBox::warning(Gui::getMainWindow(),