Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
deprecate QgsMapCanvas::pixmap() following QgsMapCanvasMap::pixmap()
- Loading branch information
|
@@ -65,7 +65,11 @@ class QgsMapCanvas : QGraphicsView |
|
|
QgsMapRenderer* mapRenderer(); |
|
|
|
|
|
//! Accessor for the canvas pixmap |
|
|
QPixmap& canvasPixmap(); |
|
|
// @deprecated use canvasPaintDevice() |
|
|
QPixmap& canvasPixmap() /Deprecated/; |
|
|
|
|
|
//! Accessor for the canvas paint device |
|
|
QPaintDevice &canvasPaintDevice(); |
|
|
|
|
|
//! Get the last reported scale of the canvas |
|
|
double scale(); |
|
|
|
@@ -42,7 +42,8 @@ class QgsMapCanvasMap : QGraphicsRectItem |
|
|
|
|
|
void setPanningOffset(const QPoint& point); |
|
|
|
|
|
QPixmap& pixmap(); |
|
|
//! @deprecated Please use paintDevice() function which is also save in case QImage is used |
|
|
QPixmap& pixmap() /Deprecated/; |
|
|
|
|
|
void paint(QPainter* p, const QStyleOptionGraphicsItem*, QWidget*); |
|
|
|
|
|
|
@@ -422,7 +422,11 @@ void QgsMapCanvas::saveAsImage( QString theFileName, QPixmap * theQPixmap, QStri |
|
|
} |
|
|
else //use the map view |
|
|
{ |
|
|
mMap->pixmap().save( theFileName, theFormat.toLocal8Bit().data() ); |
|
|
QPixmap *pixmap = dynamic_cast<QPixmap *>( &mMap->paintDevice() ); |
|
|
if( !pixmap ) |
|
|
return; |
|
|
|
|
|
pixmap->save( theFileName, theFormat.toLocal8Bit().data() ); |
|
|
} |
|
|
//create a world file to go with the image... |
|
|
QgsRectangle myRect = mMapRenderer->extent(); |
|
@@ -1232,10 +1236,33 @@ bool QgsMapCanvas::isFrozen() |
|
|
|
|
|
QPixmap& QgsMapCanvas::canvasPixmap() |
|
|
{ |
|
|
return mMap->pixmap(); |
|
|
} // canvasPixmap |
|
|
QPixmap *pixmap = dynamic_cast<QPixmap *>( &canvasPaintDevice() ); |
|
|
if( pixmap ) |
|
|
{ |
|
|
return *pixmap; |
|
|
} |
|
|
|
|
|
qWarning( "QgsMapCanvas::canvasPixmap() deprecated - returning static pixmap instance - use QgsMapCanvas::paintDevice()" ); |
|
|
|
|
|
static QPixmap staticPixmap; |
|
|
|
|
|
QImage *image = dynamic_cast<QImage *>( &mMap->paintDevice() ); |
|
|
if( image ) |
|
|
{ |
|
|
staticPixmap = QPixmap::fromImage( *image ); |
|
|
} |
|
|
else |
|
|
{ |
|
|
staticPixmap = QPixmap( canvasPaintDevice().width(), canvasPaintDevice().height() ); |
|
|
} |
|
|
|
|
|
return staticPixmap; |
|
|
} // canvasPixmap |
|
|
|
|
|
QPaintDevice &QgsMapCanvas::canvasPaintDevice() |
|
|
{ |
|
|
return mMap->paintDevice(); |
|
|
} |
|
|
|
|
|
double QgsMapCanvas::mapUnitsPerPixel() const |
|
|
{ |
|
|
|
@@ -119,7 +119,11 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView |
|
|
QgsMapRenderer* mapRenderer(); |
|
|
|
|
|
//! Accessor for the canvas pixmap |
|
|
QPixmap& canvasPixmap(); |
|
|
//! @deprecated use canvasPaintDevice() |
|
|
QGISDEPRECATED QPixmap& canvasPixmap(); |
|
|
|
|
|
//! Accessor for the canvas paint device |
|
|
QPaintDevice &canvasPaintDevice(); |
|
|
|
|
|
//! Get the last reported scale of the canvas |
|
|
double scale(); |
|
|