aTransformationPoint.Point = aPoint;
aTransformationPoint.Caption = aCaption;
- aTransformationPoint.PointItem = new QGraphicsEllipseItem( this );
- aTransformationPoint.PointItem->setVisible( false );
- aTransformationPoint.PointItem->setPen( QPen( aColor ) );
- aTransformationPoint.PointItem->setBrush( QBrush( aColor ) );
+ QGraphicsEllipseItem* aPointItem = new QGraphicsEllipseItem( this );
+ aPointItem->setPen( QPen( aColor ) );
+ aPointItem->setBrush( QBrush( aColor ) );
double aRadius = 3;
QRectF aRect( -QPointF( aRadius, aRadius ), QSizeF( aRadius * 2 + 1, aRadius * 2 + 1 ) );
- aTransformationPoint.PointItem->setRect( aRect );
- aTransformationPoint.PointItem->setFlag( QGraphicsItem::ItemIgnoresTransformations );
- aTransformationPoint.PointItem->setPos( aPoint );
-
- aTransformationPoint.CaptionItem = new QGraphicsSimpleTextItem( aCaption, this );
- aTransformationPoint.CaptionItem->setVisible( false );
- aTransformationPoint.CaptionItem->setPen( QPen( aColor ) );
- aTransformationPoint.CaptionItem->setBrush( QBrush( aColor ) );
- QFont aFont = aTransformationPoint.CaptionItem->font();
+ aPointItem->setRect( aRect );
+ aPointItem->setPos( QPointF( 0, 0 ) );
+
+ QGraphicsSimpleTextItem* aCaptionItem = aCaptionItem = new QGraphicsSimpleTextItem( aCaption, this );
+ aCaptionItem->setPen( QPen( aColor ) );
+ aCaptionItem->setBrush( QBrush( aColor ) );
+ QFont aFont = aCaptionItem->font();
aFont.setPointSize( qApp->font().pointSize() );
- aTransformationPoint.CaptionItem->setFont( aFont );
- aTransformationPoint.CaptionItem->setFlag( QGraphicsItem::ItemIgnoresTransformations );
+ aCaptionItem->setFont( aFont );
+ aCaptionItem->setPos( QPointF( -aRadius * 2, aRadius * 2 ) );
+
+ aTransformationPoint.GroupItem = new QGraphicsItemGroup( this );
+ aTransformationPoint.GroupItem->addToGroup( aPointItem );
+ aTransformationPoint.GroupItem->addToGroup( aCaptionItem );
+ aTransformationPoint.GroupItem->setVisible( false );
+ aTransformationPoint.GroupItem->setFlag( QGraphicsItem::ItemIgnoresTransformations );
+ aTransformationPoint.GroupItem->setPos( aPoint );
myTransformationPointMap[ aPointType ] = aTransformationPoint;
}
TransformationPoint& aTransformationPoint = myTransformationPointMap[ thePointType ];
- double aRadius = 3;
const QPointF& aPoint = aTransformationPoint.Point;
- aTransformationPoint.PointItem->setPos( aPoint );
- aTransformationPoint.PointItem->setVisible( anIsPointVisible );
-
- QPointF aCaptionShift( -aRadius * 2, aRadius * 2 );
- aTransformationPoint.CaptionItem->setPos( aPoint + aCaptionShift );
- aTransformationPoint.CaptionItem->setVisible( anIsPointVisible );
+ aTransformationPoint.GroupItem->setPos( aPoint );
+ aTransformationPoint.GroupItem->setVisible( anIsPointVisible );
}
//================================================================