PartDesign: Fix loft preview

This commit is contained in:
Stefan Tröger 2016-04-15 16:34:15 +02:00 committed by wmayer
parent c5ca99658b
commit 4f8973fe8e
3 changed files with 19 additions and 40 deletions

View File

@ -79,6 +79,14 @@ TaskLoftParameters::TaskLoftParameters(ViewProviderLoft *LoftView,bool newObj, Q
// Temporarily prevent unnecessary feature recomputes
for(QWidget* child : proxy->findChildren<QWidget*>())
child->blockSignals(true);
//add the profiles
for(auto obj : static_cast<PartDesign::Loft*>(LoftView->getObject())->Sections.getValues()) {
QString objn = QString::fromLatin1(obj->getNameInDocument());
if(!objn.isEmpty())
ui->listWidgetReferences->addItem(objn);
}
// activate and de-activate dialog elements as appropriate
for(QWidget* child : proxy->findChildren<QWidget*>())

View File

@ -78,52 +78,21 @@ bool ViewProviderLoft::doubleClicked(void)
bool ViewProviderLoft::setEdit(int ModNum)
{
if (ModNum == ViewProvider::Default || ModNum == 1 ) {
if (ModNum == ViewProvider::Default)
setPreviewDisplayMode(true);
// When double-clicking on the item for this pad the
// object unsets and sets its edit mode without closing
// the task panel
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
TaskDlgLoftParameters *padDlg = qobject_cast<TaskDlgLoftParameters *>(dlg);
if (padDlg && padDlg->getLoftView() != this)
padDlg = 0; // another pad left open its task panel
if (dlg && !padDlg) {
QMessageBox msgBox;
msgBox.setText(QObject::tr("A dialog is already open in the task panel"));
msgBox.setInformativeText(QObject::tr("Do you want to close this dialog?"));
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::Yes);
int ret = msgBox.exec();
if (ret == QMessageBox::Yes)
Gui::Control().reject();
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 (padDlg)
Gui::Control().showDialog(padDlg);
else
Gui::Control().showDialog(new TaskDlgLoftParameters(this,ModNum == 1));
return true;
}
else {
return ViewProviderPart::setEdit(ModNum);
}
return ViewProviderAddSub::setEdit(ModNum);
}
TaskDlgFeatureParameters* ViewProviderLoft::getEditDialog() {
return new TaskDlgLoftParameters(this);
}
void ViewProviderLoft::unsetEdit(int ModNum) {
setPreviewDisplayMode(false);
PartDesignGui::ViewProvider::unsetEdit(ModNum);
ViewProviderAddSub::unsetEdit(ModNum);
}

View File

@ -49,6 +49,8 @@ public:
protected:
virtual bool setEdit(int ModNum);
virtual void unsetEdit(int ModNum);
virtual TaskDlgFeatureParameters* getEditDialog();
virtual QIcon getIcon(void) const;
private: