##// END OF EJS Templates
Prevent the creation of events with the same product on 2 graphs
trabillard -
r1312:fc19e80a8809
parent child
Show More
@@ -90,14 +90,21 void CatalogueActionManager::installSelectionZoneActions()
90 90 auto &actionController = sqpApp->actionsGuiController();
91 91
92 92 auto createEventEnableFuntion = [](auto zones) {
93 QSet<VisualizationGraphWidget *> usedGraphs;
93
94 // Checks that all variables in the zones doesn't refer to the same product
95 QSet<QString> usedDatasource;
94 96 for (auto zone : zones) {
95 97 auto graph = zone->parentGraphWidget();
96 if (!usedGraphs.contains(graph)) {
97 usedGraphs.insert(graph);
98 }
99 else {
100 return false;
98 auto variables = graph->variables();
99
100 for (auto var : variables) {
101 auto datasourceId = var->metadata().value(DataSourceItem::ID_DATA_KEY).toString();
102 if (!usedDatasource.contains(datasourceId)) {
103 usedDatasource.insert(datasourceId);
104 }
105 else {
106 return false;
107 }
101 108 }
102 109 }
103 110
General Comments 0
You need to be logged in to leave comments. Login now