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.
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.