PartGui: avoid code duplication for handing TaskAttacher

A better fix for #0004188

Delay calling setPreviewDisplayMode() in ViewProviderPrimitive::setEdit
also fixed issue of not turning off preview mode if the user cancels
editing because there is already a task dialog active.
This commit is contained in:
Zheng, Lei
2020-02-08 21:37:01 +08:00
committed by wmayer
parent 147b00f2cb
commit 4dad08eff6
2 changed files with 5 additions and 2 deletions

View File

@@ -746,6 +746,7 @@ TaskPrimitiveParameters::TaskPrimitiveParameters(ViewProviderPrimitive* Primitiv
primitive = new TaskBoxPrimitives(PrimitiveView);
Content.push_back(primitive);
/*
// handle visibility automation differently to the default method
auto customvisfunc = [] (bool opening_not_closing,
const std::string &postfix,
@@ -780,6 +781,8 @@ TaskPrimitiveParameters::TaskPrimitiveParameters(ViewProviderPrimitive* Primitiv
}
};
parameter = new PartGui::TaskAttacher(PrimitiveView, nullptr, QString(), tr("Attachment"), customvisfunc);
*/
parameter = new PartGui::TaskAttacher(PrimitiveView, nullptr, QString(), tr("Attachment"));
Content.push_back(parameter);
}

View File

@@ -81,8 +81,6 @@ void ViewProviderPrimitive::setupContextMenu(QMenu* menu, QObject* receiver, con
bool ViewProviderPrimitive::setEdit(int ModNum)
{
if (ModNum == ViewProvider::Default ) {
setPreviewDisplayMode(true);
// When double-clicking on the item for this fillet the
// object unsets and sets its edit mode without closing
// the task panel
@@ -114,6 +112,8 @@ bool ViewProviderPrimitive::setEdit(int ModNum)
else
Gui::Control().showDialog(new TaskPrimitiveParameters(this));
setPreviewDisplayMode(true);
return true;
}
else {