- 博客(0)
- 资源 (1)
- 收藏
- 关注
testGraphicsView角度旋转正确.rar
通过qt图形视图绘制可拉伸矩形,圆等,并可随意旋转角度,继承qgraphicsitem if(isSelected())
{
if(m_dir == Right && (event->buttons() & Qt::RightButton)){
double ang = 0;
double x = m_cenPt.x()-m_movePoint.x();
double y = m_cenPt.y()-m_movePoint.y();
if(abs(x) > 0.001){
if(x < 0){
ang = atan(y/x)*180/PI; //通过弧度求角度
if(ang scenePos());
}
else
QGraphicsItem::mouseMoveEvent(event); //如果在拉伸时也调用,则会位置设置不对
}
2020-07-23
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人