- TransformationPoint aTransformationPoint;
-
- QPoint aPoint;
- QString aCaption;
- QColor aColor = Qt::black;
- switch( aPointType )
- {
- case PointA:
- aPoint = QPoint( 0, 0 );
- aCaption = "A";
- aColor = Qt::darkRed;
- break;
- case PointB:
- aPoint = QPoint( aWidth, 0 );
- aCaption = "B";
- aColor = Qt::darkGreen;
- break;
- case PointC:
- aPoint = QPoint( 0, aHeight );
- aCaption = "C";
- aColor = Qt::darkBlue;
- break;
- }
-
- aTransformationPoint.Point = aPoint;
- aTransformationPoint.Caption = aCaption;
-
- 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 ) );
- 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() );
- 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;