! \copydoc QCPPlottableInterface1D::selectTestRect */
| 24645 | \copydoc QCPPlottableInterface1D::selectTestRect |
| 24646 | */ |
| 24647 | QCPDataSelection QCPBars::selectTestRect(const QRectF &rect, bool onlySelectable) const |
| 24648 | { |
| 24649 | QCPDataSelection result; |
| 24650 | if ((onlySelectable && mSelectable == QCP::stNone) || mDataContainer->isEmpty()) |
| 24651 | return result; |
| 24652 | if (!mKeyAxis || !mValueAxis) |
| 24653 | return result; |
| 24654 | |
| 24655 | QCPBarsDataContainer::const_iterator visibleBegin, visibleEnd; |
| 24656 | getVisibleDataBounds(visibleBegin, visibleEnd); |
| 24657 | |
| 24658 | for (QCPBarsDataContainer::const_iterator it=visibleBegin; it!=visibleEnd; ++it) |
| 24659 | { |
| 24660 | if (rect.intersects(getBarRect(it->key, it->value))) |
| 24661 | result.addDataRange(QCPDataRange(int(it-mDataContainer->constBegin()), int(it-mDataContainer->constBegin()+1)), false); |
| 24662 | } |
| 24663 | result.simplify(); |
| 24664 | return result; |
| 24665 | } |
| 24666 | |
| 24667 | /*! |
| 24668 | Implements a selectTest specific to this plottable's point geometry. |
no test coverage detected