Beispiel #1
0
void Draw_Ellipse::setRotate(const QPointF &pnt,const QPointF &pnt1)
{
    if(pnt1.x()>pnt.x())
    {
       angle+=0.5;
       item->setRotation(angle);
       Strt_Rect->setRotation(angle);
       End_Rect->setRotation(angle);
       Rot_Rect->setRotation(angle);
    }

    if(pnt.x()>pnt1.x())
    {
       angle-=0.5;
       item->setRotation(angle);
       Strt_Rect->setRotation(angle);
       End_Rect->setRotation(angle);
       Rot_Rect->setRotation(angle);
    }

    item->update();
    Strt_Rect->update();
    End_Rect->update();
    Rot_Rect->update();


    QPointF rot_pnt(item->boundingRect().topLeft()-item->sceneBoundingRect().topLeft());
    QPointF rot_pnt1(item->boundingRect().bottomRight()-item->sceneBoundingRect().bottomRight());

    setStartPoint(item->sceneBoundingRect().topLeft()+rot_pnt);
    setEndPoint(item->sceneBoundingRect().bottomRight()+rot_pnt1);

}
Beispiel #2
0
void Draw_Triangle::setRotate(const QPointF &pnt,const QPointF &pnt1)
{

    if(pnt1.x()>pnt.x())
    {
       angle+=0.5;
       item->setRotation(angle);
     for(int i=0;i<handles.size();i++)
     {
       handles[i]->setRotation(angle);
       handles[i]->update();
     }
       Rot_Rect->setRotation(angle);
       Bounding_Rect->setRotation(angle);
    }

    if(pnt.x()>pnt1.x())
    {
       angle-=0.5;
       item->setRotation(angle);
     for(int i=0;i<handles.size();i++)
     {
      handles[i]->setRotation(angle);
      handles[i]->update();
     }
       Rot_Rect->setRotation(angle);
       Bounding_Rect->setRotation(angle);
    }

    item->update();
    Rot_Rect->update();
    Bounding_Rect->update();


    QPointF rot_pnt(item->boundingRect().topLeft()-item->sceneBoundingRect().topLeft());
    QPointF rot_pnt1(item->boundingRect().bottomRight()-item->sceneBoundingRect().bottomRight());



    //setStartPoint(item->sceneBoundingRect().topLeft());
    //setEndPoint(item->sceneBoundingRect().bottomRight());



  //qDebug()<<"rot triangle pnts "<<Strt_Rect->mapFromScene(item->sceneBoundingRect().bottomLeft())<<"  "<<End_Rect->mapFromScene(item->sceneBoundingRect().bottomRight())<<"\n";

  print();


}