aAction->setChecked(true);
+ aAction = new QAction(QIcon(":pictures/find_result.png"), tr("Select results"), this);
+ addAction("SHOW_RESULTS_CMD", aAction);
+
buildObjBrowserMenu();
buildViewerMenu();
}
}
if (!hasSubFeature && allActive && (hasFeature|| hasParameter))
action("CLEAN_HISTORY_CMD")->setEnabled(true);
+
+ action("SHOW_RESULTS_CMD")->setEnabled(hasFeature);
}
// Show/Hide command has to be disabled for objects from non active document
aList.append(action("CLEAN_HISTORY_CMD"));
aList.append(mySeparator);
aList.append(action("RENAME_CMD"));
+ aList.append(mySeparator);
+ aList.append(action("SHOW_RESULTS_CMD"));
myObjBrowserMenus[ModelAPI_Feature::group()] = aList;
aList.clear();
setViewerSelectionMode(TopAbs_FACE);
} else if (theId == "SELECT_RESULT_CMD") {
setViewerSelectionMode(-1);
+ } else if (theId == "SHOW_RESULTS_CMD") {
+ highlightResults(aObjects);
}
}
if (theUpdateViewer)
myDisplayer->updateViewer();
}
+
+void XGUI_Workshop::highlightResults(const QObjectPtrList& theObjects)
+{
+ FeaturePtr aFeature;
+ QObjectPtrList aSelList = theObjects;
+ std::list<ResultPtr> aResList;
+ foreach(ObjectPtr aObj, theObjects) {
+ aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
+ if (aFeature.get()) {
+ aResList = aFeature->results();
+ std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aIt;
+ for(aIt = aResList.cbegin(); aIt != aResList.cend(); aIt++) {
+ aSelList.append(*aIt);
+ }
+ }
+ }
+ if (aSelList.count() > theObjects.count()) {
+ // if something was found
+ bool aBlocked = objectBrowser()->blockSignals(true);
+ objectBrowser()->setObjectsSelected(aSelList);
+ objectBrowser()->blockSignals(aBlocked);
+ }
+}
/// \param isToConnect a boolean value whether connect or disconnect
void connectToPropertyPanel(const bool isToConnect);
+ /// Returns defailt selection mode in 3d viewer
+ int viewerSelectionMode() const { return myViewerSelMode; }
+
+ /// Highlights result objects in Object Browser according to
+ /// features found in the given list
+ void highlightResults(const QObjectPtrList& theObjects);
+
/// A constant string used for "Move to end" command definition
/// It is used for specific processing of Undo/Redo for this command.
static QString MOVE_TO_END_COMMAND;
/// Activates/deactivates the trihedron in the viewer AIS context
void onTrihedronVisibilityChanged(bool theState);
- /// Returns defailt selection mode in 3d viewer
- int viewerSelectionMode() const { return myViewerSelMode; }
-
protected:
/// Sets the granted operations for the parameter operation. Firstly, it finds the nested features
<file>pictures/shell.png</file>
<file>pictures/wire.png</file>
<file>pictures/result.png</file>
+ <file>pictures/find_result.png</file>
</qresource>
</RCC>