}
std::vector<int> XGUI_ColorDialog::getColor() const
+{
+ QColor aColorResult = myColorButton->color();
+
+ std::vector<int> aValues;
+ aValues.push_back(aColorResult.red());
+ aValues.push_back(aColorResult.green());
+ aValues.push_back(aColorResult.blue());
+
+ return aValues;
+}
+
+std::vector<int> XGUI_ColorDialog::getRandomColor() const
{
std::vector<int> aValues;
if (isRandomColor()) {
ModelAPI_Tools::findRandomColor(aValues);
}
- else {
- QColor aColorResult = myColorButton->color();
- aValues.push_back(aColorResult.red());
- aValues.push_back(aColorResult.green());
- aValues.push_back(aColorResult.blue());
- }
return aValues;
}
/// \return a vector of values
std::vector<int> getColor() const;
+ /// Returns a container with the current color value. These are tree int values for RGB definition.
+ /// It returns the next random color.
+ /// \return a vector of values
+ std::vector<int> getRandomColor() const;
+
private:
QButtonGroup* myButtonGroup; /// a group, contained random and certain color radio button choice
QtxColorButton* myColorButton; /// a control to select a color
aActions.append(mySeparator);
aActions.append(action("DELETE_CMD"));
//aActions.append(action("MOVE_CMD"));
+ aActions.append(action("COLOR_CMD"));
}
theMenu->addActions(aActions);
if (aResult.get() != NULL) {
ResultCompSolidPtr aCompsolidResult = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(aResult);
if (aCompsolidResult.get() != NULL) { // change colors for all sub-solids
- for(int i = 0; i < aCompsolidResult->numberOfSubs(); i++)
- setColor(aCompsolidResult->subResult(i), aColorResult);
+ for(int i = 0; i < aCompsolidResult->numberOfSubs(); i++) {
+ setColor(aCompsolidResult->subResult(i), !isRandomColor ? aColorResult : aDlg->getRandomColor());
+ }
}
- setColor(aResult, aColorResult);
+ setColor(aResult, !isRandomColor ? aColorResult : aDlg->getRandomColor());
}
}
if (!aWasOperation)