PartDesign NewSketch: Add a parameter to use attachment dialog instead of feature pick

This commit is contained in:
PaddleStroke
2024-12-12 11:13:59 +01:00
committed by Chris Hennes
parent ddd86bd7b3
commit a61db12828
5 changed files with 89 additions and 22 deletions

View File

@@ -111,27 +111,13 @@ void ViewProviderAttachExtension::extensionSetupContextMenu(QMenu* menu, QObject
}
}
void ViewProviderAttachExtension::showAttachmentEditor()
void ViewProviderAttachExtension::showAttachmentEditor(std::function<void()> onAccept, std::function<void()> onReject)
{
if (Gui::Control().activeDialog()) {
Gui::Control().closeDialog();
}
// See PropertyEnumAttacherItem::openTask()
Gui::TaskView::TaskDialog* dlg = Gui::Control().activeDialog();
TaskDlgAttacher* task;
task = qobject_cast<TaskDlgAttacher*>(dlg);
if (dlg && !task) {
// there is already another task dialog which must be closed first
Gui::Control().showDialog(dlg);
return;
}
if (!task) {
task = new TaskDlgAttacher(getExtendedViewProvider());
}
TaskDlgAttacher* task = new TaskDlgAttacher(getExtendedViewProvider(), true, onAccept, onReject);
Gui::Control().showDialog(task);
}