[PD] add feature to highlight references in some dialogs

- also fix some logic issues and avoid to break the feature (deleting the last item is now no longer possible)
This commit is contained in:
donovaly
2020-02-16 05:18:29 +01:00
parent a76bc63e4d
commit d40eb2dbfc
10 changed files with 769 additions and 452 deletions

View File

@@ -41,6 +41,7 @@
#include <Gui/Selection.h>
#include <Gui/Command.h>
#include <Gui/MainWindow.h>
#include <Mod/PartDesign/App/Body.h>
#include <Mod/PartDesign/App/FeatureDressUp.h>
#include <Mod/PartDesign/Gui/ReferenceSelection.h>
@@ -153,6 +154,44 @@ void TaskDressUpParameters::onButtonRefRemove(const bool checked)
}
}
void TaskDressUpParameters::doubleClicked(QListWidgetItem* item) {
// executed when the user selected a new item in the list
// shows the fillets as they are -> useful to switch out of selection mode
// assure we are not in selection mode
exitSelectionMode();
clearButtons(none);
// assure the fillets are shown
showObject();
// remove any highlights andd selections
DressUpView->highlightReferences(false);
Gui::Selection().clearSelection();
}
void TaskDressUpParameters::setSelection(QListWidgetItem* current) {
// executed when the user selected a new item in the list
// highlights the currently selected item
// name of the item
std::string subName = current->text().toStdString();
// get the document name
std::string docName = DressUpView->getObject()->getDocument()->getName();
// get the name of the body we are in
Part::BodyBase* body = PartDesign::Body::findBodyOf(DressUpView->getObject());
std::string objName = body->getNameInDocument();
// hide fillet to see the original edge
// (a fillet creates new edges so that the original one is not available)
hideObject();
// highlight all objects in the list
DressUpView->highlightReferences(true);
// clear existing selections
Gui::Selection().clearSelection();
// highligh the selected item
Gui::Selection().addSelection(docName.c_str(), objName.c_str(), subName.c_str(), 0, 0, 0);
}
const std::vector<std::string> TaskDressUpParameters::getReferences() const
{
PartDesign::DressUp* pcDressUp = static_cast<PartDesign::DressUp*>(DressUpView->getObject());