Skip to content

Commit 79fb8ae

Browse files
committedFeb 28, 2017
Improve documentation for QgsMapCanvas and remove false QGIS 3 TODO
1 parent 8094cf9 commit 79fb8ae

File tree

3 files changed

+37
-38
lines changed

3 files changed

+37
-38
lines changed
 

‎python/gui/qgsmapcanvas.sip

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -170,23 +170,9 @@ class QgsMapCanvas : QGraphicsView
170170

171171
//! return list of layers within map canvas.
172172
QList<QgsMapLayer*> layers() const;
173-
174-
/**
175-
* Freeze/thaw the map canvas. This is used to prevent the canvas from
176-
* responding to events while layers are being added/removed etc.
177-
* @param frz Boolean specifying if the canvas should be frozen (true) or
178-
* thawed (false). Default is true.
179-
*
180-
* TODO remove in QGIS 3
181-
*/
182-
void freeze( bool frz = true );
183-
184-
/**
185-
* Accessor for frozen status of canvas
186-
*
187-
* TODO remove in QGIS 3
188-
*/
189-
bool isFrozen();
173+
void freeze( bool frozen = true );
174+
bool isFrozen() const;
175+
bool renderFlag() const;
190176

191177
//! Get the current canvas map units
192178
QgsUnitTypes::DistanceUnit mapUnits() const;
@@ -347,11 +333,7 @@ class QgsMapCanvas : QGraphicsView
347333

348334
//! This slot is connected to the layer's CRS change
349335
void layerCrsChange();
350-
351-
//! Whether to suppress rendering or not
352336
void setRenderFlag( bool flag );
353-
//! State of render suppression flag
354-
bool renderFlag();
355337

356338
//! stop rendering (if there is any right now)
357339
//! @note added in 2.4

‎src/gui/qgsmapcanvas.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ void QgsMapCanvas::refresh()
443443
return;
444444
}
445445

446-
if ( !mRenderFlag || mFrozen ) // do we really need two flags controlling rendering?
446+
if ( !mRenderFlag || mFrozen )
447447
{
448448
QgsDebugMsg( "CANVAS render flag off" );
449449
return;
@@ -1555,15 +1555,15 @@ void QgsMapCanvas::layerCrsChange()
15551555
} // layerCrsChange
15561556

15571557

1558-
void QgsMapCanvas::freeze( bool frz )
1558+
void QgsMapCanvas::freeze( bool frozen )
15591559
{
1560-
mFrozen = frz;
1561-
} // freeze
1560+
mFrozen = frozen;
1561+
}
15621562

1563-
bool QgsMapCanvas::isFrozen()
1563+
bool QgsMapCanvas::isFrozen() const
15641564
{
15651565
return mFrozen;
1566-
} // freeze
1566+
}
15671567

15681568

15691569
double QgsMapCanvas::mapUnitsPerPixel() const

‎src/gui/qgsmapcanvas.h

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -232,19 +232,32 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
232232
/**
233233
* Freeze/thaw the map canvas. This is used to prevent the canvas from
234234
* responding to events while layers are being added/removed etc.
235-
* @param frz Boolean specifying if the canvas should be frozen (true) or
235+
* @param frozen Boolean specifying if the canvas should be frozen (true) or
236236
* thawed (false). Default is true.
237-
*
238-
* TODO remove in QGIS 3
237+
* @see isFrozen()
238+
* @see setRenderFlag(). freeze() should be used to programmatically halt map updates,
239+
* while setRenderFlag() should only be used when users disable rendering via GUI.
239240
*/
240-
void freeze( bool frz = true );
241+
void freeze( bool frozen = true );
241242

242243
/**
243-
* Accessor for frozen status of canvas
244-
*
245-
* TODO remove in QGIS 3
244+
* Returns true if canvas is frozen.
245+
* @see renderFlag(). isFrozen() should be used to determine whether map updates
246+
* have been halted programmatically, while renderFlag() should be used to
247+
* determine whether a user has disabled rendering via GUI.
248+
* @see freeze()
246249
*/
247-
bool isFrozen();
250+
bool isFrozen() const;
251+
252+
/**
253+
* Returns true if canvas render is disabled as a result of user disabling
254+
* renders via the GUI.
255+
* @see setRenderFlag()
256+
* @see isFrozen(). isFrozen() should be used to determine whether map updates
257+
* have been halted programmatically, while renderFlag() should be used to
258+
* determine whether a user has disabled rendering via GUI.
259+
*/
260+
bool renderFlag() const { return mRenderFlag; }
248261

249262
/**
250263
* Convience function for returning the current canvas map units. The map units
@@ -409,10 +422,14 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
409422
//! This slot is connected to the layer's CRS change
410423
void layerCrsChange();
411424

412-
//! Whether to suppress rendering or not
425+
/**
426+
* Sets whether a user has disabled canvas renders via the GUI.
427+
* @param flag set to false to indicate that user has disabled renders
428+
* @see renderFlag()
429+
* @see freeze(). freeze() should be used to programmatically halt map updates,
430+
* while setRenderFlag() should only be used when users disable rendering via GUI.
431+
*/
413432
void setRenderFlag( bool flag );
414-
//! State of render suppression flag
415-
bool renderFlag() {return mRenderFlag;}
416433

417434
//! stop rendering (if there is any right now)
418435
//! @note added in 2.4

0 commit comments

Comments
 (0)
Please sign in to comment.