class VerticalMarker : public QCPItemLine
{
    Q_OBJECT
public:
    VerticalMarker(double xCoord, QCustomPlot* plot, QColor color);
    VerticalMarker(double xCoord, QCustomPlot* plot, QColor color, QColor selectedColor);
    void setXCoord(double xCoordl);
    double getXCoord();
    void setPixelXCoord(double xPixel);
    void updateHeight(int height);
    double getPixelXCoord();
    void updateAbsPosition();

protected:
    double mXCoord;
    double mPixelXCoord;
    int mPixelHeight;
    QCustomPlot* mPlot;
};


VerticalMarker::VerticalMarker(double xCoord, QCustomPlot* plot, QColor color, QColor selectedColor): QCPItemLine (plot),
    mXCoord(xCoord),
    mPlot(plot)
{
    setPen(QPen(color));
    setSelectedPen(QPen(selectedColor));
    setParent(plot);
    setClipToAxisRect(false);
    start->setType( QCPItemPosition::PositionType::ptAbsolute);
    end->setType( QCPItemPosition::PositionType::ptAbsolute);
    setVisible(true);
    mPixelXCoord = mPlot->xAxis->coordToPixel(mXCoord);
}

I have a problem that could be easily showed by images and I'll try to describe:

I have a plot made by many axisrects piled one over the other. they ideally have all the same x coordinates but I show the labels only on the bottom one. each axis rect has its own y axis.
I need to plot a vertical bar that I can make start from over the bottom X axis and reaches the top of the plot.
I found so far 2 ways and none works as it should:

1. I draw a QCPItemLine with points of ptPlotCoords type, NOT clipped to Axis Rect. It works correctly when I compose the whole plot and its positioned where it's expected BUT it obviously goes over the tick labels of the bottom axis.

2. I draw a QCPItemLine - as in the code above - with points of ptAbsolute type, yet NOT clipped to AxisRect and I set its position in pixel converting from the x coordinate that's the data I know. The problem is that when I compose the plot it's not known exactly how much the tick labels on the Y axes will be wide so converting coordinate in pixel gives the wrong x pixel. I haven't found in which function the real position of the axes has been already calculated so that I can finally calculate the correct x pixel of my verticall bar.