PDA

View Full Version : Is it possible to QCoreApplication.sendEvent a hand made QDropEvent ?



BillGates
26th May 2011, 02:28
Is it possible to manually create a custom QDropEvent, and then send it to a widget ?


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


The above is not working. It does work for myEvent subclass of QEvent, but not for a QDropEvent. I am curious why.

wysota
28th May 2011, 08:31
Did you send drag enter event and drag move event prior to sending the drop event?