X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_PrsImageFrame.cxx;h=30a691257307807e5cff77423127545426d6ef4a;hb=a53349567d67f4df0ef737798a25c24d9dc8f08e;hp=058d0ea6ea38d75804ef0846a99fb72ac291db5c;hpb=d74afc6389ed4e656c9451ac01b4065470746fd8;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_PrsImageFrame.cxx b/src/HYDROGUI/HYDROGUI_PrsImageFrame.cxx index 058d0ea6..30a69125 100644 --- a/src/HYDROGUI/HYDROGUI_PrsImageFrame.cxx +++ b/src/HYDROGUI/HYDROGUI_PrsImageFrame.cxx @@ -1,12 +1,8 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// +// Copyright (C) 2014-2015 EDF-R&D // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -164,14 +160,26 @@ QRectF HYDROGUI_PrsImageFrame::UnscaledGraphicsEllipseItem::boundingRect() const if( !aParent ) return aRect; - QTransform aTransform = aParent->getViewTransform(); - double aScale = aTransform.m11(); // same as m22(), viewer specific - if( fabs( aScale ) < EPSILON ) + // take into account a transformation of the base image item + double aXScale = 1.0; + double aYScale = 1.0; + if( QGraphicsItem* aGrandParent = aParent->parentItem() ) + { + QTransform aTransform = aGrandParent->transform(); + QLineF aLine( 0, 0, 1, 1 ); + aLine = aTransform.map( aLine ); + aXScale = aLine.dx(); + aYScale = aLine.dy(); + } + + QTransform aViewTransform = aParent->getViewTransform(); + double aScale = aViewTransform.m11(); // same as m22(), viewer specific + if( fabs( aScale ) < EPSILON || fabs( aXScale ) < EPSILON || fabs( aYScale ) < EPSILON) return aRect; QPointF aCenter = aRect.center(); - double aWidth = aRect.width() / aScale; - double aHeight = aRect.height() / aScale; + double aWidth = aRect.width() / aScale / aXScale; + double aHeight = aRect.height() / aScale / aYScale; aRect = QRectF( aCenter.x() - aWidth / 2, aCenter.y() - aHeight / 2, aWidth, aHeight ); return aRect; @@ -205,7 +213,6 @@ void HYDROGUI_PrsImageFrame::UnscaledGraphicsEllipseItem::paint( thePainter->save(); thePainter->setTransform( GenerateTranslationOnlyTransform( thePainter->transform(), myBasePoint ) ); - QGraphicsEllipseItem::paint( thePainter, theOption, theWidget ); thePainter->restore(); }