PartDesign: Add transparent previews
This commit is contained in:
@@ -63,59 +63,24 @@ void ViewProviderHole::setupContextMenu(QMenu* menu, QObject* receiver, const ch
|
||||
PartGui::ViewProviderPart::setupContextMenu(menu, receiver, member); // clazy:exclude=skipped-base-method
|
||||
}
|
||||
|
||||
bool ViewProviderHole::setEdit(int ModNum)
|
||||
{
|
||||
if (ModNum == ViewProvider::Default ) {
|
||||
// When double-clicking on the item for this hole the
|
||||
// object unsets and sets its edit mode without closing
|
||||
// the task panel
|
||||
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
|
||||
TaskDlgHoleParameters *holeDlg = qobject_cast<TaskDlgHoleParameters *>(dlg);
|
||||
if (holeDlg && holeDlg->getViewObject() != this)
|
||||
holeDlg = nullptr; // another hole left open its task panel
|
||||
if (dlg && !holeDlg) {
|
||||
QMessageBox msgBox(Gui::getMainWindow());
|
||||
msgBox.setText(QObject::tr("A dialog is already open in the task panel"));
|
||||
msgBox.setInformativeText(QObject::tr("Close this dialog?"));
|
||||
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
||||
msgBox.setDefaultButton(QMessageBox::Yes);
|
||||
int ret = msgBox.exec();
|
||||
if (ret == QMessageBox::Yes)
|
||||
Gui::Control().closeDialog();
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
// clear the selection (convenience)
|
||||
Gui::Selection().clearSelection();
|
||||
|
||||
// always change to PartDesign WB, remember where we come from
|
||||
oldWb = Gui::Command::assureWorkbench("PartDesignWorkbench");
|
||||
|
||||
// start the edit dialog
|
||||
if (holeDlg)
|
||||
Gui::Control().showDialog(holeDlg);
|
||||
else
|
||||
Gui::Control().showDialog(new TaskDlgHoleParameters(this));
|
||||
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return PartGui::ViewProviderPart::setEdit(ModNum); // clazy:exclude=skipped-base-method
|
||||
}
|
||||
}
|
||||
|
||||
bool ViewProviderHole::onDelete(const std::vector<std::string> &s)
|
||||
bool ViewProviderHole::onDelete(const std::vector<std::string>& s)
|
||||
{
|
||||
// get the Sketch
|
||||
PartDesign::Hole* pcHole = getObject<PartDesign::Hole>();
|
||||
Sketcher::SketchObject *pcSketch = nullptr;
|
||||
if (pcHole->Profile.getValue())
|
||||
Sketcher::SketchObject* pcSketch = nullptr;
|
||||
if (pcHole->Profile.getValue()) {
|
||||
pcSketch = static_cast<Sketcher::SketchObject*>(pcHole->Profile.getValue());
|
||||
}
|
||||
|
||||
// if abort command deleted the object the sketch is visible again
|
||||
if (pcSketch && Gui::Application::Instance->getViewProvider(pcSketch))
|
||||
if (pcSketch && Gui::Application::Instance->getViewProvider(pcSketch)) {
|
||||
Gui::Application::Instance->getViewProvider(pcSketch)->show();
|
||||
}
|
||||
|
||||
return ViewProvider::onDelete(s);
|
||||
}
|
||||
|
||||
TaskDlgFeatureParameters* ViewProviderHole::getEditDialog()
|
||||
{
|
||||
return new TaskDlgHoleParameters(this);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user