Esempio n. 1
0
Shape::Shape() :
	QGraphicsRectItem()
{
	setShapeName( "Shape" );

	setText( "Some Text" );
	setTextColor( QColor::fromHsv(rand()%256,255,190) );

	setText( "Some Text" );
	setTextColor( QColor::fromHsv(rand()%256,255,190) );

	setLineColor( QColor::fromHsv(rand()%256,255,190) );
	setFillColor( QColor::fromHsv(rand()%256,255,190) );

	setScenePosition( QPointF(100,100) );
	setGeometry( QRectF(-100,-50,200,100) );
}
void GlOverviewGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent* event) {
  if(mouseClicked)
    setScenePosition(event->pos());
}
void GlOverviewGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent* event) {
  if(event->button()==Qt::LeftButton) {
    mouseClicked=true;
    setScenePosition(event->pos());
  }
}