Skip to content
Permalink
Browse files

Move triggerRepaint() to QgsMapLayer, use it instead of deprecated cl…

…earCacheImage()
  • Loading branch information
wonder-sk committed Sep 11, 2014
1 parent ed11c57 commit fba5c5a6561cf389f785d06f9e3235005976a17a
@@ -395,9 +395,17 @@ class QgsMapLayer : QObject
bool hasScaleBasedVisibility() const;

/** Clear cached image
* @deprecated in 2.4 - caches listen to repaintRequested() signal to invalidate the cached image */
* @deprecated in 2.4 - use triggerRepaint() - caches automatically listen to repaintRequested() signal to invalidate the cached image */
void clearCacheImage() /Deprecated/;

/**
* Will advice the map canvas (and any other interested party) that this layer requires to be repainted.
* Will emit a repaintRequested() signal.
*
* @note in 2.6 function moved from vector/raster subclasses to QgsMapLayer
*/
void triggerRepaint();

/** \brief Obtain Metadata for this layer */
virtual QString metadata();

@@ -1157,8 +1157,6 @@ class QgsVectorLayer : QgsMapLayer
*/
void removeSelection();

void triggerRepaint();

/** Update the extents for the layer. This is necessary if features are
* added/deleted or the layer has been subsetted.
*/
@@ -191,9 +191,6 @@ class QgsRasterLayer : QgsMapLayer
QImage previewAsImage( QSize size, QColor bgColor = QColor( 255, 255, 255 ),
QImage::Format format = QImage::Format_ARGB32_Premultiplied );

/** \brief Emit a signal asking for a repaint. (inherited from maplayer) */
void triggerRepaint();

/**
* Reorders the *previously selected* sublayers of this layer from bottom to top
*
@@ -6984,7 +6984,7 @@ void QgisApp::setLayerCRS()
if ( child->layer() )
{
child->layer()->setCrs( crs );
child->layer()->clearCacheImage();
child->layer()->triggerRepaint();
}
}
}
@@ -6994,7 +6994,7 @@ void QgisApp::setLayerCRS()
if ( nodeLayer->layer() )
{
nodeLayer->layer()->setCrs( crs );
nodeLayer->layer()->clearCacheImage();
nodeLayer->layer()->triggerRepaint();
}
}
}
@@ -7111,7 +7111,7 @@ void QgisApp::legendGroupSetCRS()
if ( nodeLayer->layer() )
{
nodeLayer->layer()->setCrs( crs );
nodeLayer->layer()->clearCacheImage();
nodeLayer->layer()->triggerRepaint();
}
}
}
@@ -8587,7 +8587,7 @@ void QgisApp::layersWereAdded( QList<QgsMapLayer *> theLayers )

if ( provider )
{
connect( provider, SIGNAL( dataChanged() ), layer, SLOT( clearCacheImage() ) );
connect( provider, SIGNAL( dataChanged() ), layer, SLOT( triggerRepaint() ) );
connect( provider, SIGNAL( dataChanged() ), mMapCanvas, SLOT( refresh() ) );
}
}
@@ -466,7 +466,7 @@ void QgsBrowser::updateCurrentTab()
QgsRasterLayer *rlayer = qobject_cast< QgsRasterLayer * >( mLayer );
if ( rlayer )
{
connect( rlayer->dataProvider(), SIGNAL( dataChanged() ), rlayer, SLOT( clearCacheImage() ) );
connect( rlayer->dataProvider(), SIGNAL( dataChanged() ), rlayer, SLOT( triggerRepaint() ) );
connect( rlayer->dataProvider(), SIGNAL( dataChanged() ), mapCanvas, SLOT( refresh() ) );
}
}
@@ -195,7 +195,7 @@ bool QgsSymbolV2LegendNode::setData( const QVariant& value, int role )
emit dataChanged();

if ( mLayerNode->isVisible() )
vlayer->clearCacheImage();
vlayer->triggerRepaint();

return true;
}
@@ -1403,6 +1403,11 @@ void QgsMapLayer::clearCacheImage()
emit repaintRequested();
}

void QgsMapLayer::triggerRepaint()
{
emit repaintRequested();
}

QString QgsMapLayer::metadata()
{
return QString();
@@ -413,9 +413,17 @@ class CORE_EXPORT QgsMapLayer : public QObject
bool hasScaleBasedVisibility() const;

/** Clear cached image
* @deprecated in 2.4 - caches listen to repaintRequested() signal to invalidate the cached image */
* @deprecated in 2.4 - use triggerRepaint() - caches automatically listen to repaintRequested() signal to invalidate the cached image */
Q_DECL_DEPRECATED void clearCacheImage();

/**
* Will advice the map canvas (and any other interested party) that this layer requires to be repainted.
* Will emit a repaintRequested() signal.
*
* @note in 2.6 function moved from vector/raster subclasses to QgsMapLayer
*/
void triggerRepaint();

/** \brief Obtain Metadata for this layer */
virtual QString metadata();

@@ -566,11 +566,6 @@ void QgsVectorLayer::removeSelection()
setSelectedFeatures( QgsFeatureIds() );
}

void QgsVectorLayer::triggerRepaint()
{
emit repaintRequested();
}

QgsVectorDataProvider* QgsVectorLayer::dataProvider()
{
return mDataProvider;
@@ -1514,12 +1514,6 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
*/
void removeSelection();

/**
* Will advice the map canvas (and any other interested party) that this layer requires to be repainted.
* Will emit a repaintRequested() signal.
*/
void triggerRepaint();

/** Update the extents for the layer. This is necessary if features are
* added/deleted or the layer has been subsetted.
*/
@@ -1189,11 +1189,6 @@ QImage QgsRasterLayer::previewAsImage( QSize size, QColor bgColor, QImage::Forma
return myQImage;
}

void QgsRasterLayer::triggerRepaint()
{
emit repaintRequested();
}

void QgsRasterLayer::updateProgress( int theProgress, int theMax )
{
Q_UNUSED( theProgress );
@@ -351,9 +351,6 @@ class CORE_EXPORT QgsRasterLayer : public QgsMapLayer
QImage previewAsImage( QSize size, QColor bgColor = Qt::white,
QImage::Format format = QImage::Format_ARGB32_Premultiplied );

/** \brief Emit a signal asking for a repaint. (inherited from maplayer) */
void triggerRepaint();

/**
* Reorders the *previously selected* sublayers of this layer from bottom to top
*

0 comments on commit fba5c5a

Please sign in to comment.
You can’t perform that action at this time.