@@ -37,8 +37,8 @@ QgsQuickMapCanvasMap::QgsQuickMapCanvasMap( QQuickItem *parent )
37
37
connect ( &mRefreshTimer , &QTimer::timeout, this , &QgsQuickMapCanvasMap::refreshMap );
38
38
connect ( &mMapUpdateTimer , &QTimer::timeout, this , &QgsQuickMapCanvasMap::renderJobUpdated );
39
39
40
- connect ( mMapSettings , &QgsQuickMapSettings::extentChanged, this , &QgsQuickMapCanvasMap::onExtentChanged );
41
- connect ( mMapSettings , &QgsQuickMapSettings::layersChanged, this , &QgsQuickMapCanvasMap::onLayersChanged );
40
+ connect ( mMapSettings . get () , &QgsQuickMapSettings::extentChanged, this , &QgsQuickMapCanvasMap::onExtentChanged );
41
+ connect ( mMapSettings . get () , &QgsQuickMapSettings::layersChanged, this , &QgsQuickMapCanvasMap::onLayersChanged );
42
42
43
43
connect ( this , &QgsQuickMapCanvasMap::renderStarting, this , &QgsQuickMapCanvasMap::isRenderingChanged );
44
44
connect ( this , &QgsQuickMapCanvasMap::mapCanvasRefreshed, this , &QgsQuickMapCanvasMap::isRenderingChanged );
@@ -50,22 +50,13 @@ QgsQuickMapCanvasMap::QgsQuickMapCanvasMap( QQuickItem *parent )
50
50
setFlags ( QQuickItem::ItemHasContents );
51
51
}
52
52
53
- QgsQuickMapCanvasMap::~QgsQuickMapCanvasMap ()
54
- {
55
- Q_ASSERT ( mMapSettings );
56
- delete mMapSettings ;
57
- mMapSettings = nullptr ;
58
- }
59
-
60
53
QgsQuickMapSettings *QgsQuickMapCanvasMap::mapSettings () const
61
54
{
62
- Q_ASSERT ( mMapSettings );
63
- return mMapSettings ;
55
+ return mMapSettings .get ();
64
56
}
65
57
66
58
void QgsQuickMapCanvasMap::zoom ( QPointF center, qreal scale )
67
59
{
68
- Q_ASSERT ( mMapSettings );
69
60
QgsRectangle extent = mMapSettings ->extent ();
70
61
QgsPoint oldCenter ( extent.center () );
71
62
QgsPoint mousePos ( mMapSettings ->screenToCoordinate ( center ) );
@@ -79,7 +70,6 @@ void QgsQuickMapCanvasMap::zoom( QPointF center, qreal scale )
79
70
80
71
void QgsQuickMapCanvasMap::pan ( QPointF oldPos, QPointF newPos )
81
72
{
82
- Q_ASSERT ( mMapSettings );
83
73
QgsPoint start = mMapSettings ->screenToCoordinate ( oldPos.toPoint () );
84
74
QgsPoint end = mMapSettings ->screenToCoordinate ( newPos.toPoint () );
85
75
@@ -99,8 +89,6 @@ void QgsQuickMapCanvasMap::pan( QPointF oldPos, QPointF newPos )
99
89
100
90
void QgsQuickMapCanvasMap::refreshMap ()
101
91
{
102
- Q_ASSERT ( mMapSettings );
103
-
104
92
stopRendering (); // if any...
105
93
106
94
QgsMapSettings mapSettings = mMapSettings ->mapSettings ();
@@ -194,7 +182,6 @@ void QgsQuickMapCanvasMap::onWindowChanged( QQuickWindow *window )
194
182
195
183
void QgsQuickMapCanvasMap::onScreenChanged ( QScreen *screen )
196
184
{
197
- Q_ASSERT ( mMapSettings );
198
185
if ( screen )
199
186
mMapSettings ->setOutputDpi ( screen->physicalDotsPerInch () );
200
187
}
@@ -209,7 +196,6 @@ void QgsQuickMapCanvasMap::onExtentChanged()
209
196
210
197
void QgsQuickMapCanvasMap::updateTransform ()
211
198
{
212
- Q_ASSERT ( mMapSettings );
213
199
QgsMapSettings currentMapSettings = mMapSettings ->mapSettings ();
214
200
QgsMapToPixel mtp = currentMapSettings.mapToPixel ();
215
201
@@ -317,7 +303,6 @@ QSGNode *QgsQuickMapCanvasMap::updatePaintNode( QSGNode *oldNode, QQuickItem::Up
317
303
void QgsQuickMapCanvasMap::geometryChanged ( const QRectF &newGeometry, const QRectF &oldGeometry )
318
304
{
319
305
Q_UNUSED ( oldGeometry )
320
- Q_ASSERT ( mMapSettings );
321
306
// The Qt documentation advices to call the base method here.
322
307
// However, this introduces instabilities and heavy performance impacts on Android.
323
308
// It seems on desktop disabling it prevents us from downsizing the window...
@@ -330,7 +315,6 @@ void QgsQuickMapCanvasMap::geometryChanged( const QRectF &newGeometry, const QRe
330
315
331
316
void QgsQuickMapCanvasMap::onLayersChanged ()
332
317
{
333
- Q_ASSERT ( mMapSettings );
334
318
if ( mMapSettings ->extent ().isEmpty () )
335
319
zoomToFullExtent ();
336
320
@@ -369,7 +353,6 @@ void QgsQuickMapCanvasMap::stopRendering()
369
353
370
354
void QgsQuickMapCanvasMap::zoomToFullExtent ()
371
355
{
372
- Q_ASSERT ( mMapSettings );
373
356
QgsRectangle extent;
374
357
const QList<QgsMapLayer *> layers = mMapSettings ->layers ();
375
358
for ( QgsMapLayer *layer : layers )
@@ -391,7 +374,6 @@ void QgsQuickMapCanvasMap::zoomToFullExtent()
391
374
392
375
void QgsQuickMapCanvasMap::refresh ()
393
376
{
394
- Q_ASSERT ( mMapSettings );
395
377
if ( mMapSettings ->outputSize ().isNull () )
396
378
return ; // the map image size has not been set yet
397
379
0 commit comments