[QScintilla] Overriding dropEvent

Baz Walter bazwal at ftml.net
Fri Dec 7 18:58:24 GMT 2007


Phil Thompson wrote:
> On Friday 07 December 2007, Baz Walter wrote:
>> Hello
>>
>> I'm trying to implement a feature found in SciTE which converts line
>> endings when the user imports text from the clipboard or via drag and
>> drop. I've implemented standard paste and selection paste (middle button
>> click) without any problems, but drag and drop has got me completely stuck.
>>
>> The problem is, is that I am using the python bindings and have no way
>> to access Scintilla's Editor.DropAt within my dropEvent handler. I also
>> can't think of a way to patch QScintilla to make this possible. All I
>> really want to do is modify the dropped text before it gets handed to
>> Scintilla.
>>
>> Any ideas how I can make progress with this?
> 
> I must be missing something, but why not create a new QDropEvent in your 
> reimplementation of dropEvent() that contains the modified text and pass it 
> to QsciScintillaBase::dropEvent()?

I tried this, but with no success. QDropEvent doesn't seem to be 
designed to used in this way - there's no way to set the text for an 
instance or pass it to the constructor. I suppose this is because the 
dragged data has to be requested from the source (which could be from 
another application). For similar reasons subclassing/delegation won't 
work either. QDropEvents seem to be pretty complicated under the hood 
because they inherit from both QMimeSource and QEvent. So unless I'm 
also missing something, I can't see how to do it this way.

--
Baz


More information about the QScintilla mailing list