[Qgis-user] Tool to copy the content of the map canvas to the clipboard

Richard Duivenvoorde rdmailings at duif.net
Wed Dec 21 00:44:50 PST 2016


On 12/20/2016 09:43 PM, Larry Shaffer wrote:
>     2016-12-20 18:23 GMT+01:00 Bo Victor Thomsen
>     <bo.victor.thomsen at gmail.com <mailto:bo.victor.thomsen at gmail.com>>:
>
>         Hi List-members -
>
>         Is there in Qgis a function / button / menu-item / short-cut /
>         plugin to make a simple bitmap copy of the current content of
>         the map-canvas and save it to the clipboard ? My users need this
>         to make a copy of the map and paste into MS-Word or other software.
>
>
> While not part of the QGIS app, one could use this PyQGIS snippet to do
> so (tested quickly on macOS 10.11.6 under QGIS 2.14) from the PyQGIS
> console:
>
> from PyQt4.QtGui import *
> QApplication.clipboard().setImage(QImage(QPixmap.grabWidget(iface.mapCanvas())))
>
> This avoids having to re-render the QGraphicsView (QgsMapCanvas) to a
> paint device, like an image. Code can be wrapped in a plugin, then have
> some key bindings applied (would need some more PyQt).

Tested here on Linux: working fine too!!

I think this looks like a nice (easy?) feature request to make this core 
functionality?

- right-click menu on mapcanvas with:
   - save Map to Clipboard
   (- set size of MapCanvas to...) I know this is also often needed...

- one or two buttons to do this?

While a plugin works for older versions, I think it should not be needed 
for a teacher/user to hear: install QGIS and add the following 
plugins.... (while that is actually what I often have to say....)

I think I could even try to do this :-)

Regards,

Richard Duivenvoorde




More information about the Qgis-user mailing list