In my MainWindow, i have a QCP as CentralWidget and DockWidget on the right side with a TabWidget.

In one of the Tabs i have a TableWidget, which shows the x- and y-values over the mouse-position.
Here is my code for this (for me, it works like i want):

void gvPlotter::showCursor(QMouseEvent *event)
{
    if(plot->graphCount() > 0)
    {
        QCPGraph *graph = plot->graph(0);

        phaseTracer->setGraph(graph);
        phaseTracer->setGraphKey(plot->xAxis->pixelToCoord(event->pos().x()));
        plot->replot();

        QPointF temp = phaseTracer->position->coords();

        QToolTip::showText(event->globalPos(),
                           tr("<h4>%L1</h4>"
                           "<table>"
                               "<tr>"
                                   "<td><h5>X: %L2</h5></td>" "<td>  ,  </td>" "<td><h5>Y: %L3</h5></td>"
                               "</tr>"
                           "</table>").arg(graph->name()).arg(QString::number(temp.x(), 'f', 0)).arg(QString::number(temp.y(), 'f', 1)), plot, plot->rect());
    }

    //Cursor over plot
    double mouseX = plot->xAxis->pixelToCoord(event->pos().x());
    double startPos = plot->yAxis->pixelToCoord(0);
    double endPos = plot->yAxis->pixelToCoord(plot->size().height());
    cursor->start->setCoords(mouseX, startPos);
    cursor->end->setCoords(mouseX, endPos);
    plot->replot();

    //values for all graphs
    QVector<QVector<QString> > sampleVector(plot->graphCount());
    QVector<QColor> sampleVectorColors(plot->graphCount());

    double x;
    double y;

    for(int i=0; i<plot->graphCount(); ++i)
    {
        //wenn maus innerhalb von Graph(i)
        if(mouseX >= 0 && mouseX <= (plot->graph(i)->dataMainKey(plot->graph(i)->dataCount() - 1) + 1))
        {
            cursorIndex = plot->graph(i)->findBegin(mouseX);
            x = plot->graph(i)->dataMainKey(cursorIndex);
            y = plot->graph(i)->dataMainValue(cursorIndex);
        }
        else
        {
            cursorIndex = -1;
            x = 0;
            y = 0;
        }

        QVector<QString> infos(4);
        infos[0] = plot->graph(i)->name();
        infos[1] = QString::number(cursorIndex);
        if(x == 0)
        {
            infos[2] = "-";
        }
        else
        {
            infos[2] = QString::number(x, 'f', 2);
        }

        if(y == 0)
        {
            infos[3] = "-";
        }
        else
        {
            infos[3] = QString::number(y, 'f', 2);
        }

        sampleVector[i] = infos;
        sampleVectorColors[i] = plot->graph(i)->pen().color();

        emit plotSample(plot->xAxis->label(), plot->yAxis->label(), plot->graphCount(), sampleVectorColors, sampleVector);
    }
}

The function is connected to the mouseMove-Event of the customPlot (plot in my case).


Now to my actual question:
In the tab I have two Buttons at the bottom. I want to move the cursor one index to the left/right with it.

Anyone has an idea, how to do that?