! Returns the legends that currently have selected parts, i.e. whose selection state is not \ref QCPLegend::spNone. \see selectedPlottables, selectedAxes, setInteractions, QCPLegend::setSelectedParts, QCPLegend::setSelectableParts, QCPLegend::selectedItems */
| 14351 | QCPLegend::setSelectableParts, QCPLegend::selectedItems |
| 14352 | */ |
| 14353 | QList<QCPLegend*> QCustomPlot::selectedLegends() const |
| 14354 | { |
| 14355 | QList<QCPLegend*> result; |
| 14356 | |
| 14357 | QStack<QCPLayoutElement*> elementStack; |
| 14358 | if (mPlotLayout) |
| 14359 | elementStack.push(mPlotLayout); |
| 14360 | |
| 14361 | while (!elementStack.isEmpty()) |
| 14362 | { |
| 14363 | foreach (QCPLayoutElement *subElement, elementStack.pop()->elements(false)) |
| 14364 | { |
| 14365 | if (subElement) |
| 14366 | { |
| 14367 | elementStack.push(subElement); |
| 14368 | if (QCPLegend *leg = qobject_cast<QCPLegend*>(subElement)) |
| 14369 | { |
| 14370 | if (leg->selectedParts() != QCPLegend::spNone) |
| 14371 | result.append(leg); |
| 14372 | } |
| 14373 | } |
| 14374 | } |
| 14375 | } |
| 14376 | |
| 14377 | return result; |
| 14378 | } |
| 14379 | |
| 14380 | /*! |
| 14381 | Deselects all layerables (plottables, items, axes, legends,...) of the QCustomPlot. |
nothing calls this directly
no test coverage detected