I set the plot to `CP::iRangeDrag | QCP::iRangeZoom`, which means the text will be moved around but anchored to the QCPItemStraightLine all the time on the top. From my understanding, I just need to set the text position alginment to `top` and set the parent anchor to `point2`, then it should work magically. But it does not. Could someone please help me out of this? Any help is greatly appreciated! BTW, Kudos to the QCustomplot authors.
QCPItemStraightLine* atm_line = new QCPItemStraightLine(ui_->plot); atm_line->setPen(QPen(Qt::green)); atm_line->point1->setCoords(selected_scope_->ref_base_price(), 0); atm_line->point2->setCoords(selected_scope_->ref_base_price(), 1); QCPItemText* text= new QCPItemText(ui_->plot); text->setPositionAlignment(Qt::AlignTop); text->position->setParentAnchor(atm_line->point2);