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

Bo Victor Thomsen bo.victor.thomsen at gmail.com
Wed Dec 21 01:32:42 PST 2016


Hi Larry -

The python snippet works like a charm on Windows too. I'll wrap a 
minimalistic python plugin around the snippet with a button and a 
short-cut. I owe you a large cold beer (actually several :-) . That 
snippet saved me from digging into a rather large pile of Qgis/PyQT 
documentation.  You'll get the beer(s) when we meet at some FOSS4G or 
Qgis event..

DelazJ: Yes, I was referring to the "Save as image". I simply couldn't 
remember the English translation for the menu item (Working with a 
Danish Qgis)

Karl-Magnus: (regarding snipping tool) - That's exactly what my users 
presently are doing. But even that is a bit too much work with the mouse 
and keyboard :-)

Richard: Actually, there already is a feature request for this function 
(http://hub.qgis.org/issues/10319) . I'll update the existing request. 
And thank you for the Qgis3 update (You'll get a beer too :-) . If it 
becomes necessary, I'll update the plugin to 3.0. But I hope that some 
developer with commit rights will have mercy on me and write this 
functionality into Qgis 3.0 core.

Regards

Bo Victor Thomsen
Municipality of Frederikssund


Den 20-12-2016 kl. 21:43 skrev Larry Shaffer:
> Hi,
>
> On Tue, Dec 20, 2016 at 11:02 AM, DelazJ <delazj at gmail.com 
> <mailto:delazj at gmail.com>> wrote:
>
>     Hi,
>
>     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).
>
> Larry Shaffer
> Dakota Cartography
> Black Hills, South Dakota
>
>         I really need the functionality for my users and I can't seem
>         to find it. The closest I've come is the "save as png"
>         menu-item in the project menu. But it's to cumbersome to use
>         in this case.
>
>
>     Afaics, there's no "save as png" option but "save as image" in
>     Project menu, option from which you can choose the image file
>     format (bmp, jpg...). It's not on the clipboard but easier and
>     more accessible than print composer.
>
>     Regards,
>     Harrissou
>
>
>         I'm familiar with the composer function. My users can't use
>         this neither because it takes to long to activate (to many
>         choices and to many buttons to click)
>
>         So I've decided to make a simple plugin to cover this
>         functionality. But first I want to be very sure the function
>         actually is missing ;-)
>
>         Regards
>         Bo Victor Thomsen
>         Municipality of Frederikssund, Denmark.
>         _______________________________________________
>         Qgis-user mailing list
>         Qgis-user at lists.osgeo.org <mailto:Qgis-user at lists.osgeo.org>
>         List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
>         <http://lists.osgeo.org/mailman/listinfo/qgis-user>
>         Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user
>         <http://lists.osgeo.org/mailman/listinfo/qgis-user>
>
>
>
>     _______________________________________________
>     Qgis-user mailing list
>     Qgis-user at lists.osgeo.org <mailto:Qgis-user at lists.osgeo.org>
>     List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
>     <http://lists.osgeo.org/mailman/listinfo/qgis-user>
>     Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user
>     <http://lists.osgeo.org/mailman/listinfo/qgis-user>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20161221/8ff22dca/attachment.html>


More information about the Qgis-user mailing list