<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>I don't know if this helps but I copy data from QGIS onto the clipboard in this manner. I'm sure you can go the other way as well.<br></div><div><br></div><div>from qgis.PyQt.QtWidgets import QApplication<br></div><div>text = 'This is a test'<br></div><div>clipboard = QApplication.clipboard()</div><div>clipboard.setText(text)<br></div><div><br></div><div>Calvin<br></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, May 22, 2019 at 4:36 AM Martin Pergler <<a href="mailto:mp@pergler.org">mp@pergler.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Can one access the internal QGIS clipboard (as defined in  qgsclipboard.h/cpp) in a python script or plugin within QGis desktop?<br><br>I've tried QgsApplication.clipboard() and QApplication.clipboard, both of which return a PyQt5 QClipboard object rather than a QgsClipboard.<br><br>In a plugin I'm developing, I'd love to make use of features copied to the clipboard in native format (e.g. via the copyOf() method of QgsClipboard). However, if I get a QClipboard I only have access to a text() representation, the WKT or geoJson format of the features depending on Settings -> Options -> Data sources -> Copy features as... The same is also accessible as -- apparently -- the only MIME type via .mimeData().formats(). <br clear="all"><div><br></div><div>I'm running QGis version 3.6.3 on Win10. (Note this is dup of <a href="https://gis.stackexchange.com/questions/322878/accessing-internal-qgis-clipboard-in-python" target="_blank">https://gis.stackexchange.com/questions/322878/accessing-internal-qgis-clipboard-in-python</a> that I asked a week ago).<br></div><div><br></div><div>Thanks!</div><div><br></div>-- <br><div dir="ltr" class="gmail-m_2548920836295995435gmail_signature">Martin Pergler<br><a href="mailto:mp@pergler.org" target="_blank">mp@pergler.org</a></div></div>
_______________________________________________<br>
QGIS-Developer mailing list<br>
<a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a></blockquote></div>