@@ -166,6 +166,24 @@ void QgsPaperItem::paint( QPainter* painter, const QStyleOptionGraphicsItem* ite
166
166
}
167
167
168
168
painter->save ();
169
+
170
+ if ( mComposition ->plotStyle () == QgsComposition::Preview )
171
+ {
172
+ // if in preview mode, draw page border and shadow so that it's
173
+ // still possible to tell where pages with a transparent style begin and end
174
+ painter->setRenderHint ( QPainter::Antialiasing, false );
175
+
176
+ // shadow
177
+ painter->setBrush ( QBrush ( QColor ( 150 , 150 , 150 ) ) );
178
+ painter->setPen ( Qt::NoPen );
179
+ painter->drawRect ( QRectF ( 1 , 1 , rect ().width () + 1 , rect ().height () + 1 ) );
180
+
181
+ // page area
182
+ painter->setBrush ( QColor ( 215 , 215 , 215 ) );
183
+ painter->setPen ( QPen ( QColor ( 100 , 100 , 100 ) ) );
184
+ painter->drawRect ( QRectF ( 0 , 0 , rect ().width (), rect ().height () ) );
185
+ }
186
+
169
187
painter->setRenderHint ( QPainter::Antialiasing );
170
188
mComposition ->pageStyleSymbol ()->startRender ( context );
171
189
@@ -217,6 +235,11 @@ void QgsPaperItem::initialize()
217
235
setFlag ( QGraphicsItem::ItemIsMovable, false );
218
236
setZValue ( 0 );
219
237
238
+ // even though we aren't going to use it to draw the page, set the pen width as 4
239
+ // so that the page border and shadow is fully rendered within its scene rect
240
+ // (QGraphicsRectItem considers the pen width when calculating an item's scene rect)
241
+ setPen ( QPen ( QBrush ( Qt::NoBrush ), 4 ) );
242
+
220
243
// create a new QgsPaperGrid for this page, and add it to the composition
221
244
mPageGrid = new QgsPaperGrid ( pos ().x (), pos ().y (), rect ().width (), rect ().height (), mComposition );
222
245
mComposition ->addItem ( mPageGrid );
0 commit comments