I use a QCPItemStraightLine item as a cursor spanning multiple QCPAxisRects in the same QCustomplot (https://postimg.org/image/atkjrqv09). The problem is that if I set setClipToAxisRect(true) to span all the QCPAxisRects, then the QCPItemStraightLine can be dragged outside the QCPAxisRects (https://postimg.org/image/fe6q6oepl).

The QCustomPlot itself doesn't have any QCPAxisRect, as I cleared them up following the AdvancedAxesDemo (http://www.qcustomplot.com/index.php/demos/advancedaxesdemo) before adding new QCPAxisRect dynamically following user interactions.

Is there a way to limit the position of the QCPItemStraightLine only in one direction?