! \copydoc QCPPlottableInterface1D::selectTestRect */
| 23887 | \copydoc QCPPlottableInterface1D::selectTestRect |
| 23888 | */ |
| 23889 | QCPDataSelection QCPBars::selectTestRect(const QRectF &rect, bool onlySelectable) const |
| 23890 | { |
| 23891 | QCPDataSelection result; |
| 23892 | if ((onlySelectable && mSelectable == QCP::stNone) || mDataContainer->isEmpty()) |
| 23893 | return result; |
| 23894 | if (!mKeyAxis || !mValueAxis) |
| 23895 | return result; |
| 23896 | |
| 23897 | QCPBarsDataContainer::const_iterator visibleBegin, visibleEnd; |
| 23898 | getVisibleDataBounds(visibleBegin, visibleEnd); |
| 23899 | |
| 23900 | for (QCPBarsDataContainer::const_iterator it=visibleBegin; it!=visibleEnd; ++it) |
| 23901 | { |
| 23902 | if (rect.intersects(getBarRect(it->key, it->value))) |
| 23903 | result.addDataRange(QCPDataRange(it-mDataContainer->constBegin(), it-mDataContainer->constBegin()+1), false); |
| 23904 | } |
| 23905 | result.simplify(); |
| 23906 | return result; |
| 23907 | } |
| 23908 | |
| 23909 | /*! |
| 23910 | Implements a selectTest specific to this plottable's point geometry. |
no test coverage detected