while( anIter.hasNext() )
{
int aType = anIter.next().key();
- if( QGraphicsEllipseItem* anAnchorItem = anIter.value() )
+ if( UnscaledGraphicsEllipseItem* anAnchorItem = anIter.value() )
{
- QRectF aRect = anAnchorItem->sceneBoundingRect();
+ QRectF aRect = anAnchorItem->sceneHighlightRect();
if( aRect.contains( QPointF( theX, theY ) ) )
{
if( aType >= Top && aType <= BottomRight )
int aType = anIter.next().key();
if( UnscaledGraphicsEllipseItem* anAnchorItem = anIter.value() )
{
- QRectF aRect = anAnchorItem->sceneBoundingRect();
+ QRectF aRect = anAnchorItem->sceneHighlightRect();
if( aRect.contains( thePoint ) )
{
myPullingAnchor = aType;
}
//================================================================
-// Function : boundingRect
+// Function : highlightRect
// Purpose :
//================================================================
-QRectF GraphicsView_PrsImageFrame::UnscaledGraphicsEllipseItem::boundingRect() const
+QRectF GraphicsView_PrsImageFrame::UnscaledGraphicsEllipseItem::highlightRect() const
{
QRectF aRect = QGraphicsEllipseItem::boundingRect();
aRect = QRectF( aCenter.x() - aWidth / 2 + anOffsetX,
aCenter.y() - aHeight / 2 + anOffsetY,
aWidth, aHeight );
+ return aRect;
+}
- // to do
- //QRectF aBaseRect( myBasePoint, QSizeF( 1, 1 ) );
- //aRect |= aBaseRect;
+//================================================================
+// Function : sceneHighlightRect
+// Purpose :
+//================================================================
+QRectF GraphicsView_PrsImageFrame::UnscaledGraphicsEllipseItem::sceneHighlightRect() const
+{
+ if( QGraphicsItem* aParentItem = parentItem() )
+ return aParentItem->sceneTransform().mapRect( highlightRect() );
+ return sceneBoundingRect();
+}
- return aRect;
+//================================================================
+// Function : boundingRect
+// Purpose :
+//================================================================
+QRectF GraphicsView_PrsImageFrame::UnscaledGraphicsEllipseItem::boundingRect() const
+{
+ QRectF aHighlightRect = highlightRect();
+ QRectF aBaseRect( myBasePoint, QSizeF( 1, 1 ) );
+ return aHighlightRect | aBaseRect;
}
//================================================================
QWidget* theWidget )
{
// draw a connection line (mainly, for top-most anchor)
- //thePainter->drawLine( myBasePoint, boundingRect().center() );
+ thePainter->drawLine( myBasePoint, highlightRect().center() );
thePainter->save();
thePainter->setTransform( GenerateTranslationOnlyTransform( thePainter->transform(),
thePainter->restore();
// for debug
- //thePainter->save();
- //thePainter->setPen( QPen( Qt::magenta ) );
- //thePainter->drawRect( boundingRect() );
- //thePainter->restore();
+ /*
+ thePainter->save();
+ thePainter->setPen( QPen( Qt::magenta ) );
+ thePainter->drawRect( boundingRect() );
+ thePainter->restore();
+
+ thePainter->save();
+ thePainter->setPen( QPen( Qt::blue ) );
+ thePainter->drawRect( highlightRect() );
+ thePainter->restore();
+ */
}