Ok, the way proposed by Baz Walter works for me as well. If I change the default drop action before calling the base-class dropEvent, the default will be replaced by the previous default (set in QSciScintillaQt::StartDrag in the call qdrag->exec(...)) since the drop action is not accepted using *accept()* but using *acceptProposedAction()*.
In my case it is more the source widget that should control whether its content can be moved, copied or both and not the receiver. In the case described above (the case which works now), the implementation is done in the dropEvent of the receiver, that needs to check if the action should be switched to a copy action depending on the type of source widget. Maybe it would also be nice to being able to change the default action in the startDrag method. For instance, if the source widget is read-only and text is dragged into another widget, a move action is used as default and the dropped text is finally deleted from the source widget. I think this is not desired. So maybe there is a good solution to control this. Thanks for your answers Cheers Marc -------------------------------------------------------- Institut für Technische Optik Universität Stuttgart http://itom.bitbucket.org -------------------------------------------------------- 2014-09-17 22:21 GMT+02:00 Baz Walter <[email protected]>: > On 17/09/14 13:08, Marc Gronle wrote: > >> Hi there, >> >> I try to enable a drag&drop-action between to QScintilla widgets but I >> don't want that the text of the source window is deleted if no keyboard >> modifiers are used once the text is dropped onto another text field. >> >> I tried to changed the defaultDropAction in the drop-event of the receiver >> widget, however QSciScinitllabase::dropEvent calls acceptAction (private) >> that calls acceptProposedAction() instead of accept() such that the >> original default action of QDrag::exec is used (MoveAction). >> >> Unfortunately acceptAction is private and cannot be overwritten. >> Is there another possibility to force the source QScintilla instance not >> to >> delete the text after an arbitrary drag&drop action? >> >> I'm thankful for any suggestion. >> > > One way to change the default drop action in a reimplemented dropEvent > method, is to reset it on the event object *after* calling the base-class > dropEvent. Not sure if this is the way it's supposed to be done, but it > works for me. > > -- > Regards > Baz Walter > > _______________________________________________ > QScintilla mailing list > [email protected] > http://www.riverbankcomputing.com/mailman/listinfo/qscintilla >
_______________________________________________ QScintilla mailing list [email protected] http://www.riverbankcomputing.com/mailman/listinfo/qscintilla
