Is it possible to manually create a custom QDropEvent, and then send it to a widget ?
in a dialog.button.clicked slot:
md.setText('ZZz')
md, QtCore.
Qt.
NoButton, QtCore.
Qt.
NoModifier ,QtCore.
QEvent.
Drop )
print QtGui.
QApplication.
instance().
sendEvent( self , e
) # prints False
in a dialog.button.clicked slot:
md = QtCore.QMimeData()
md.setText('ZZz')
e = QtGui.QDropEvent( QtCore.QPoint( 1, 1 ) , QtCore.Qt.CopyAction ,
md, QtCore.Qt.NoButton, QtCore.Qt.NoModifier ,QtCore.QEvent.Drop )
print QtGui.QApplication.instance().sendEvent( self , e ) # prints False
To copy to clipboard, switch view to plain text mode
The above is not working. It does work for myEvent subclass of QEvent, but not for a QDropEvent. I am curious why.
Bookmarks