use the following code to create subplot, but how to set the subplot to zoom in specified axis?

        auto sub_plot_1 = new QCPAxisRect(p_plot);
        auto sub_plot_2 = new QCPAxisRect(p_plot);
        auto sub_plot_3 = new QCPAxisRect(p_plot);
        p_plot->plotLayout()->clear();
        p_plot->plotLayout()->addElement(0,0,sub_plot_1);
        p_plot->plotLayout()->addElement(1,0,sub_plot_2);
        p_plot->plotLayout()->addElement(2,0,sub_plot_3);

following the demo below, only the sub_plot_1 can be set to zoom only x-axis, but how to set the other subplots?
if (p_plot->xAxis->selectedParts().testFlag(QCPAxis::spAxis))
  {
      p_plot->axisRect()->setRangeZoomAxes(p_plot->xAxis, p_plot->yAxis);
      p_plot->axisRect()->setRangeZoom(p_plot->xAxis->orientation());
  }