[TD]prevent fail on delete with open dialog
This commit is contained in:
@@ -30,11 +30,14 @@
|
||||
# include <QMenu>
|
||||
#endif
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
#include <Base/Parameter.h>
|
||||
#include <App/Application.h>
|
||||
#include <App/DocumentObject.h>
|
||||
#include <Gui/ActionFunction.h>
|
||||
#include <Gui/Control.h>
|
||||
#include <Gui/MainWindow.h>
|
||||
|
||||
#include <Mod/TechDraw/App/LineGroup.h>
|
||||
#include <Mod/TechDraw/App/LandmarkDimension.h>
|
||||
@@ -283,3 +286,23 @@ bool ViewProviderDimension::canDelete(App::DocumentObject *obj) const
|
||||
Q_UNUSED(obj)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ViewProviderDimension::onDelete(const std::vector<std::string> & parms)
|
||||
{
|
||||
Q_UNUSED(parms)
|
||||
// Base::Console().Message("VPB::onDelete() - parms: %d\n", parms.size());
|
||||
auto dlg = Gui::Control().activeDialog();
|
||||
auto ourDlg = dynamic_cast<TaskDlgDimension*>(dlg);
|
||||
if (ourDlg) {
|
||||
QString bodyMessage;
|
||||
QTextStream bodyMessageStream(&bodyMessage);
|
||||
bodyMessageStream << qApp->translate("TaskDimension",
|
||||
"You cannot delete this dimension now because\nthere is an open task dialog.");
|
||||
QMessageBox::warning(Gui::getMainWindow(),
|
||||
qApp->translate("TaskDimension", "Can Not Delete"), bodyMessage,
|
||||
QMessageBox::Ok);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user