[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:
@@ -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(),
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#ifndef _PreComp_
|
||||
# include <QMessageBox>
|
||||
# include <QMessageBox>
|
||||
# include <QTextStream>
|
||||
#endif
|
||||
|
||||
@@ -188,26 +188,26 @@ double ViewProviderWeld::prefTileTextAdjust(void)
|
||||
return adjust;
|
||||
}
|
||||
|
||||
bool ViewProviderWeld::onDelete(const std::vector<std::string> &)
|
||||
{
|
||||
// a weld cannot be deleted if it has a tile
|
||||
|
||||
bool ViewProviderWeld::onDelete(const std::vector<std::string> &)
|
||||
{
|
||||
// a weld cannot be deleted if it has a tile
|
||||
|
||||
// get childs
|
||||
auto childs = claimChildren();
|
||||
|
||||
if (!childs.empty()) {
|
||||
QString bodyMessage;
|
||||
QTextStream bodyMessageStream(&bodyMessage);
|
||||
bodyMessageStream << qApp->translate("Std_Delete",
|
||||
"You cannot delete this weld symbol because\n it has a tile weld that would become broken.");
|
||||
QMessageBox::warning(Gui::getMainWindow(),
|
||||
qApp->translate("Std_Delete", "Object dependencies"), bodyMessage,
|
||||
QMessageBox::Ok);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!childs.empty()) {
|
||||
QString bodyMessage;
|
||||
QTextStream bodyMessageStream(&bodyMessage);
|
||||
bodyMessageStream << qApp->translate("Std_Delete",
|
||||
"You cannot delete this weld symbol because\n it has a tile weld that would become broken.");
|
||||
QMessageBox::warning(Gui::getMainWindow(),
|
||||
qApp->translate("Std_Delete", "Object dependencies"), bodyMessage,
|
||||
QMessageBox::Ok);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool ViewProviderWeld::canDelete(App::DocumentObject *obj) const
|
||||
|
||||
Reference in New Issue
Block a user