1 /****************************************************************
3 ** Implementation View_Frame class
5 ****************************************************************/
11 View_Frame::View_Frame( QWidget *parent, const char *name )
12 : QWidget( parent, name )
14 setBackgroundColor(QColor( 255, 255, 255) );
18 void View_Frame::SetActiveObject(char object)
20 active_object[object]=1;
24 void View_Frame::ShapeColorRect(char object,char shape,char color,QRect rect)
26 m_shape[object]=shape;
31 m_shapeColor[object]=QColor(0,0,255);
34 m_shapeColor[object]=QColor(0,255,0);
37 m_shapeColor[object]=QColor(255,0,0);
40 m_shapeColor[object]=QColor(0,0,0);
44 m_shapeRect[object]=rect;
48 void View_Frame::paintEvent(QPaintEvent*)
52 for(int i=0;i<5;i++) {
53 if (!active_object[i]) continue;
54 p.setBrush(m_shapeColor[i]);
59 p.drawRect(m_shapeRect[i]);
62 p.drawEllipse(m_shapeRect[i]);
66 pt.putPoints(0,3, m_shapeRect[i].center().x(),m_shapeRect[i].top(),
67 m_shapeRect[i].right(),m_shapeRect[i].bottom(),
68 m_shapeRect[i].left(),m_shapeRect[i].bottom());
73 strPos="X:" + QString::number(m_shapeRect[i].center().x())+
74 " Y:"+QString::number(m_shapeRect[i].center().y());
75 p.drawText(m_shapeRect[i].left()-(70-m_shapeRect[i].width())/2,m_shapeRect[i].top()-1,strPos);
80 void View_Frame::mouseMoveEvent(QMouseEvent *e)
82 if(m_mousePressed==0) return;
84 m_mouseX=e->pos().x();
85 m_mouseY=e->pos().y();
88 void View_Frame::mousePressEvent ( QMouseEvent * e)
91 m_mouseX=e->pos().x();
92 m_mouseY=e->pos().y();
95 void View_Frame::mouseReleaseEvent ( QMouseEvent * )