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:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user