Skip to content
Permalink
Browse files

Fix for bug #1717

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@10856 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent
mhugent committed May 28, 2009
1 parent d15355e commit c8a87cac5e15e0994a8dd57d4e3fb4e4d3d05290
Showing with 40 additions and 4 deletions.
  1. +38 −4 src/gui/qgscomposerview.cpp
  2. +2 −0 src/gui/qgscomposerview.h
@@ -101,6 +101,7 @@ void QgsComposerView::mousePressEvent( QMouseEvent* e )
{
QTransform t;
mRubberBandItem = new QGraphicsRectItem( 0, 0, 0, 0 );
mRubberBandStartPos = QPointF(snappedScenePoint.x(), snappedScenePoint.y());
t.translate( snappedScenePoint.x(), snappedScenePoint.y() );
mRubberBandItem->setTransform( t );
mRubberBandItem->setZValue( 100 );
@@ -235,10 +236,43 @@ void QgsComposerView::mouseMoveEvent( QMouseEvent* e )

case AddMap:
//adjust rubber band item
newWidth = scenePoint.x() - mRubberBandItem->transform().dx();
newHeight = scenePoint.y() - mRubberBandItem->transform().dy();
mRubberBandItem->setRect( 0, 0, newWidth, newHeight );
break;
{
double x = 0;
double y = 0;
double width = 0;
double height = 0;

double dx = scenePoint.x() - mRubberBandStartPos.x();
double dy = scenePoint.y() - mRubberBandStartPos.y();

if(dx < 0)
{
x = scenePoint.x();
width = -dx;
}
else
{
x = mRubberBandStartPos.x();
width = dx;
}

if(dy < 0)
{
y = scenePoint.y();
height = -dy;
}
else
{
y = mRubberBandStartPos.y();
height = dy;
}

mRubberBandItem->setRect( 0, 0, width, height );
QTransform t;
t.translate(x, y);
mRubberBandItem->setTransform(t);
break;
}

case MoveItemContent:
{
@@ -107,6 +107,8 @@ class GUI_EXPORT QgsComposerView: public QGraphicsView
QgsComposerItem* mMoveContentItem;
/**Start position of content move*/
QPointF mMoveContentStartPos;
/**Start of rubber band creation*/
QPointF mRubberBandStartPos;

public slots:
/**For QgsComposerItemGroup to send its signals to QgsComposer (or other classes that keep track of input widgets)*/

0 comments on commit c8a87ca

Please sign in to comment.
You can’t perform that action at this time.