[Qgis-user] Tool to copy the content of the map canvas to the clipboard
Richard Duivenvoorde
rdmailings at duif.net
Wed Dec 21 01:02:41 PST 2016
On 12/21/2016 09:44 AM, Richard Duivenvoorde wrote:
> 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())))
And for master/QGIS3 use:
from qgis.PyQt.QtWidgets import *
from qgis.PyQt.QtGui import *
QApplication.clipboard().setImage(QImage(QWidget.grab(iface.mapCanvas())))
Regards,
Richard
More information about the Qgis-user
mailing list