diff --git a/src/app/composer/qgscomposer.h b/src/app/composer/qgscomposer.h index 8ad1579eb11..af97d1791a7 100644 --- a/src/app/composer/qgscomposer.h +++ b/src/app/composer/qgscomposer.h @@ -212,13 +212,6 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase /**Etablishes the signal slot connection for the class*/ void connectSlots(); - /** \brief move up the content of the file - \param file file - \param from starting position - \param shift shift in bytes - */ - bool shiftFileContent( QFile *file, qint64 start, int shift ); - //! Set buttons up void setToolActionsOff( void ); diff --git a/src/app/composer/qgscomposermapwidget.cpp b/src/app/composer/qgscomposermapwidget.cpp index 0275bce1f41..e6566ff2d5c 100644 --- a/src/app/composer/qgscomposermapwidget.cpp +++ b/src/app/composer/qgscomposermapwidget.cpp @@ -98,6 +98,11 @@ void QgsComposerMapWidget::on_mPreviewModeComboBox_activated( int i ) return; } + if(mComposerMap->isDrawing()) + { + return; + } + QString comboText = mPreviewModeComboBox->currentText(); if ( comboText == tr( "Cache" ) ) { diff --git a/src/core/composer/qgscomposermap.cpp b/src/core/composer/qgscomposermap.cpp index 162594865c2..d57e6b92517 100644 --- a/src/core/composer/qgscomposermap.cpp +++ b/src/core/composer/qgscomposermap.cpp @@ -100,6 +100,13 @@ void QgsComposerMap::draw( QPainter *painter, const QgsRect& extent, const QSize return; } + if ( mDrawing ) + { + return; + } + + mDrawing = true; + QgsMapRenderer theMapRenderer; theMapRenderer.setExtent( extent ); theMapRenderer.setOutputSize( size, dpi ); @@ -119,6 +126,8 @@ void QgsComposerMap::draw( QPainter *painter, const QgsRect& extent, const QSize theMapRenderer.setScale( scale() ); theMapRenderer.render( painter ); theMapRenderer.setScale( bk_scale ); + + mDrawing = false; } void QgsComposerMap::cache( void ) @@ -158,18 +167,11 @@ void QgsComposerMap::cache( void ) void QgsComposerMap::paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget ) { - if ( mDrawing ) - { - return; - } - if ( !mComposition || !painter ) { return; } - mDrawing = true; - QRectF thisPaintRect = QRectF( 0, 0, QGraphicsRectItem::rect().width(), QGraphicsRectItem::rect().height() ); painter->save(); painter->setClipRect( thisPaintRect ); @@ -218,7 +220,6 @@ void QgsComposerMap::paint( QPainter* painter, const QStyleOptionGraphicsItem* i painter->restore(); mLastScaleFactorX = currentScaleFactorX; - mDrawing = false; } void QgsComposerMap::mapCanvasChanged( void ) @@ -251,20 +252,23 @@ void QgsComposerMap::resize( double dx, double dy ) void QgsComposerMap::moveContent( double dx, double dy ) { - QRectF itemRect = rect(); - double xRatio = dx / itemRect.width(); - double yRatio = dy / itemRect.height(); - - double xMoveMapCoord = mExtent.width() * xRatio; - double yMoveMapCoord = -( mExtent.height() * yRatio ); - - mExtent.setXMinimum( mExtent.xMin() + xMoveMapCoord ); - mExtent.setXMaximum( mExtent.xMax() + xMoveMapCoord ); - mExtent.setYmin( mExtent.yMin() + yMoveMapCoord ); - mExtent.setYmax( mExtent.yMax() + yMoveMapCoord ); - emit extentChanged(); - cache(); - update(); + if(!mDrawing) + { + QRectF itemRect = rect(); + double xRatio = dx / itemRect.width(); + double yRatio = dy / itemRect.height(); + + double xMoveMapCoord = mExtent.width() * xRatio; + double yMoveMapCoord = -( mExtent.height() * yRatio ); + + mExtent.setXMinimum( mExtent.xMin() + xMoveMapCoord ); + mExtent.setXMaximum( mExtent.xMax() + xMoveMapCoord ); + mExtent.setYmin( mExtent.yMin() + yMoveMapCoord ); + mExtent.setYmax( mExtent.yMax() + yMoveMapCoord ); + emit extentChanged(); + cache(); + update(); + } } void QgsComposerMap::setSceneRect( const QRectF& rectangle ) diff --git a/src/gui/qgscomposerview.cpp b/src/gui/qgscomposerview.cpp index d83a8f3e723..d185497126c 100644 --- a/src/gui/qgscomposerview.cpp +++ b/src/gui/qgscomposerview.cpp @@ -189,7 +189,6 @@ void QgsComposerView::mouseReleaseEvent( QMouseEvent* e ) double moveX = scenePoint.x() - mMoveContentStartPos.x(); double moveY = scenePoint.y() - mMoveContentStartPos.y(); mMoveContentItem->moveContent( -moveX, -moveY ); - mMoveContentItem->update(); mMoveContentItem = 0; } break;