From: nds Date: Thu, 9 Jan 2014 09:12:41 +0000 (+0000) Subject: Refs #311: point A size is indepenedent on size of image X-Git-Tag: BR_hydro_v_0_8~12 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7665d97e911a8b305ddbafd3ac8771b9729ab723;p=modules%2Fhydro.git Refs #311: point A size is indepenedent on size of image TODO: use one graphic item for ellipse and text label to avoid the distance increasing between them during zooming. --- diff --git a/src/HYDROGUI/HYDROGUI_PrsImage.cxx b/src/HYDROGUI/HYDROGUI_PrsImage.cxx index 172f5f72..34307fda 100644 --- a/src/HYDROGUI/HYDROGUI_PrsImage.cxx +++ b/src/HYDROGUI/HYDROGUI_PrsImage.cxx @@ -27,6 +27,7 @@ #include #include +#include //======================================================================= // name : HYDROGUI_PrsImage @@ -324,7 +325,7 @@ void HYDROGUI_PrsImage::computeTransformationPoints() aColor = Qt::darkBlue; break; } - + aTransformationPoint.Point = aPoint; aTransformationPoint.Caption = aCaption; @@ -333,10 +334,20 @@ void HYDROGUI_PrsImage::computeTransformationPoints() aTransformationPoint.PointItem->setPen( QPen( aColor ) ); aTransformationPoint.PointItem->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(); + aFont.setPointSize( qApp->font().pointSize() ); + aTransformationPoint.CaptionItem->setFont( aFont ); + aTransformationPoint.CaptionItem->setFlag( QGraphicsItem::ItemIgnoresTransformations ); myTransformationPointMap[ aPointType ] = aTransformationPoint; } @@ -358,12 +369,12 @@ void HYDROGUI_PrsImage::updateTrsfPoint( const int thePointType ) // If image is transformed only by two points then the point C is invisible bool anIsPointVisible = myIsTransformationPointPreview && ( ( !myIsByTwoPoints ) || ( myIsByTwoPoints && ( thePointType != PointC ) ) ); + TransformationPoint& aTransformationPoint = myTransformationPointMap[ thePointType ]; - double aRadius = 5; + double aRadius = 3; const QPointF& aPoint = aTransformationPoint.Point; - QRectF aRect( aPoint - QPointF( aRadius, aRadius ), QSizeF( aRadius * 2 + 1, aRadius * 2 + 1 ) ); - aTransformationPoint.PointItem->setRect( aRect ); + aTransformationPoint.PointItem->setPos( aPoint ); aTransformationPoint.PointItem->setVisible( anIsPointVisible ); QPointF aCaptionShift( -aRadius * 2, aRadius * 2 );