diff --git a/src/core/composer/qgscomposition.cpp b/src/core/composer/qgscomposition.cpp index 44731f871ffa..99b39b7ed607 100644 --- a/src/core/composer/qgscomposition.cpp +++ b/src/core/composer/qgscomposition.cpp @@ -78,7 +78,7 @@ QgsComposition::QgsComposition( QgsMapRenderer* mapRenderer ) , mAtlasPreviewEnabled( false ) , mPreventCursorChange( false ) { - setBackgroundBrush( Qt::gray ); + setBackgroundBrush( QColor( 215, 215, 215 ) ); createDefaultPageStyleSymbol(); addPaperItem(); @@ -2248,7 +2248,7 @@ void QgsComposition::renderPage( QPainter* p, int page ) setBackgroundBrush( Qt::NoBrush ); render( p, QRectF( 0, 0, paintDevice->width(), paintDevice->height() ), paperRect ); //show background after rendering - setBackgroundBrush( Qt::gray ); + setBackgroundBrush( QColor( 215, 215, 215 ) ); setSnapLinesVisible( true ); mPlotStyle = savedPlotStyle; diff --git a/src/core/composer/qgspaperitem.cpp b/src/core/composer/qgspaperitem.cpp index 1abf01968fe3..a47235480e9f 100644 --- a/src/core/composer/qgspaperitem.cpp +++ b/src/core/composer/qgspaperitem.cpp @@ -166,6 +166,24 @@ void QgsPaperItem::paint( QPainter* painter, const QStyleOptionGraphicsItem* ite } painter->save(); + + if ( mComposition->plotStyle() == QgsComposition::Preview ) + { + //if in preview mode, draw page border and shadow so that it's + //still possible to tell where pages with a transparent style begin and end + painter->setRenderHint( QPainter::Antialiasing, false ); + + //shadow + painter->setBrush( QBrush( QColor( 150, 150, 150 ) ) ); + painter->setPen( Qt::NoPen ); + painter->drawRect( QRectF( 1, 1, rect().width() + 1, rect().height() + 1 ) ); + + //page area + painter->setBrush( QColor( 215, 215, 215 ) ); + painter->setPen( QPen( QColor( 100, 100, 100 ) ) ); + painter->drawRect( QRectF( 0, 0, rect().width(), rect().height() ) ); + } + painter->setRenderHint( QPainter::Antialiasing ); mComposition->pageStyleSymbol()->startRender( context ); @@ -217,6 +235,11 @@ void QgsPaperItem::initialize() setFlag( QGraphicsItem::ItemIsMovable, false ); setZValue( 0 ); + //even though we aren't going to use it to draw the page, set the pen width as 4 + //so that the page border and shadow is fully rendered within its scene rect + //(QGraphicsRectItem considers the pen width when calculating an item's scene rect) + setPen( QPen( QBrush( Qt::NoBrush ), 4 ) ); + //create a new QgsPaperGrid for this page, and add it to the composition mPageGrid = new QgsPaperGrid( pos().x(), pos().y(), rect().width(), rect().height(), mComposition ); mComposition->addItem( mPageGrid );