Hi guys,
I want to draw a rectangle on the QCPColorMap. If i draw a static rectangle, it will show on the graph without an y problem. Same result hasn't get in dynamic way. If i set the start point and final one, it won't show any rectangle. How do i solve this problem?
rect=new QCPItemRect( ui->plotG ); rect->topLeft->setCoords(QPointF(StartPixel->x(),StartPixel->y())); rect->bottomRight->setCoords(QPointF(FinishPixel->x(),FinishPixel->y())); rect->setBrush(QBrush(QColor(200,100,100,150))); rect->setClipAxisRect(ui->plotG->axisRect()); rect->topLeft->setAxes( ui->plotG->axisRect()->axis(QCPAxis::atBottom), ui->plotG->axisRect()->axis(QCPAxis::atLeft)); rect->bottomRight->setAxes( ui->plotG->axisRect()->axis(QCPAxis::atBottom),ui->plotG->axisRect()->axis(QCPAxis::atLeft)); ui->plotG->replot(); ui->plotG->update();