! 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 */
| 15044 | QCPLegend::setSelectableParts, QCPLegend::selectedItems |
| 15045 | */ |
| 15046 | QList<QCPLegend*> QCustomPlot::selectedLegends() const |
| 15047 | { |
| 15048 | QList<QCPLegend*> result; |
| 15049 | |
| 15050 | QStack<QCPLayoutElement*> elementStack; |
| 15051 | if (mPlotLayout) |
| 15052 | elementStack.push(mPlotLayout); |
| 15053 | |
| 15054 | while (!elementStack.isEmpty()) |
| 15055 | { |
| 15056 | foreach (QCPLayoutElement *subElement, elementStack.pop()->elements(false)) |
| 15057 | { |
| 15058 | if (subElement) |
| 15059 | { |
| 15060 | elementStack.push(subElement); |
| 15061 | if (QCPLegend *leg = qobject_cast<QCPLegend*>(subElement)) |
| 15062 | { |
| 15063 | if (leg->selectedParts() != QCPLegend::spNone) |
| 15064 | result.append(leg); |
| 15065 | } |
| 15066 | } |
| 15067 | } |
| 15068 | } |
| 15069 | |
| 15070 | return result; |
| 15071 | } |
| 15072 | |
| 15073 | /*! |
| 15074 | Deselects all layerables (plottables, items, axes, legends,...) of the QCustomPlot. |