this is actually pretty easy to do.
i did this in 1.3 and not 2.0, but i'm sure you can adjust it to what they have.
1. subclass QCPItemRect
2. reimplement selectTest such that it checks whether you are close enough to your bounds (if it is just a rectangle, i think it should be implemented good enough. (mine has several sections so i have it check each section separately)
3. reimplement draw .again if it is just a rectangle , you dont need to do this
4. connect to mousePress,mouseMove, mouseRelease signals from QCustomPlot
5. on mouse press, check if the click is on or near your rectangle (at the edge for resize and center for move), set a marker for how far away your top left point was from the mouse press (i call it m_mousePressDelta)
6. on mouse move, and mouse release do something like this:
QPointF mousePos=event->localPos();
QPointF pixelPointLeft=topLeft->pixelPoint();
QPointF pixelPointRight=bottomRight->pixelPoint();
QPointF currentDelta=pixelPointLeft-mousePos-m_mousePressDelta;
currentDelta.setY(0);
switch(m_selectedPoint)
{
case eLeftHandle:
topLeft->setPixelPoint(QPointF(mousePos.x(),pixelPointLeft.y()));
if(topLeft->key()>bottomRight->key())
topLeft->setCoords(bottomRight->key(),0);
break;
case eRightHandle:
bottomRight->setPixelPoint(QPointF(mousePos.x(),pixelPointRight.y()));
if(topLeft->key()>bottomRight->key())
bottomRight->setCoords(topLeft->key(),1);
break;
case eBlock:
topLeft->setPixelPoint(pixelPointLeft-currentDelta);
bottomRight->setPixelPoint(pixelPointRight-currentDelta);
break;
}
mParentPlot->replot(QCustomPlot::rpQueued);