File tree 4 files changed +19
-2
lines changed
4 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -635,6 +635,15 @@ void QgsComposerMap::setNewAtlasFeatureExtent( const QgsRectangle& extent )
635
635
emit extentChanged ();
636
636
}
637
637
638
+ void QgsComposerMap::toggleAtlasPreview ()
639
+ {
640
+ // atlas preview has been toggled, so update item and extents
641
+ mCacheUpdated = false ;
642
+ updateItem ();
643
+ emit itemChanged ();
644
+ emit extentChanged ();
645
+ }
646
+
638
647
QgsRectangle* QgsComposerMap::currentMapExtent ()
639
648
{
640
649
// non-const version
Original file line number Diff line number Diff line change @@ -156,6 +156,9 @@ class CORE_EXPORT QgsComposerMap : public QgsComposerItem
156
156
*/
157
157
void setNewAtlasFeatureExtent ( const QgsRectangle& extent );
158
158
159
+ /* *Called when atlas preview is toggled, to force map item to update its extent and redraw*/
160
+ void toggleAtlasPreview ();
161
+
159
162
/* *Returns a pointer to the current map extent, which is either the original user specified
160
163
extent or the temporary atlas-driven feature extent depending on the current atlas state of the composition.
161
164
Both a const and non-const version are included.*/
Original file line number Diff line number Diff line change @@ -164,7 +164,7 @@ void QgsComposerScaleBar::refreshSegmentMillimeters()
164
164
if ( mComposerMap )
165
165
{
166
166
// get extent of composer map
167
- QgsRectangle composerMapRect = mComposerMap ->extent ( );
167
+ QgsRectangle composerMapRect = *( mComposerMap ->currentMapExtent () );
168
168
169
169
// get mm dimension of composer map
170
170
QRectF composerItemRect = mComposerMap ->rect ();
@@ -181,7 +181,7 @@ double QgsComposerScaleBar::mapWidth() const
181
181
return 0.0 ;
182
182
}
183
183
184
- QgsRectangle composerMapRect = mComposerMap ->extent ( );
184
+ QgsRectangle composerMapRect = *( mComposerMap ->currentMapExtent () );
185
185
if ( mUnits == MapUnits )
186
186
{
187
187
return composerMapRect.width ();
Original file line number Diff line number Diff line change @@ -2345,6 +2345,11 @@ bool QgsComposition::setAtlasPreviewEnabled( bool e )
2345
2345
}
2346
2346
}
2347
2347
2348
+ if ( mAtlasComposition .composerMap () )
2349
+ {
2350
+ mAtlasComposition .composerMap ()->toggleAtlasPreview ();
2351
+ }
2352
+
2348
2353
update ();
2349
2354
return true ;
2350
2355
}
You can’t perform that action at this time.
0 commit comments