Hi,
I need to programatically fill the clipboard with content that has custom
mime types. I could make it work with PyQt4 (with some cabarets). But when
I try the same for PySide, the application I try to paste to just freezes,
both under windows and linux. How could make this work with PySide:
#This works
from PyQt4 import QtCore, QtGui
#This doesn't
#from PySide import QtCore, QtGui
def start_app():
app = QtCore.QCoreApplication.instance()
if app is None:
print "app"
app = QtGui.QApplication([])
return app
#@run_in_qt
def set_clipboard(content, mime = 'text/plain'):
mymime = QtCore.QMimeData()
mymime.setData(mime, QtCore.QByteArray(content.encode('utf-8')))
app = start_app()
clipboard = app.clipboard()
clipboard.setMimeData(mymime)
def get_clipboard():
content = QtGui.QApplication.clipboard().mimeData()
avaiable_formats = content.formats()
return {fmt:content.data(fmt) for fmt in avaiable_formats}
#PyQt4 doesn't work without this line _outside_ any of the functions....
__app = start_app()
Any help would be appreciated.
Zahari Dimitrov.
_______________________________________________
PySide mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/pyside