[Interest] DragLeaveEvent not called?

Etienne Sandré-Chardonnal etienne.sandre at m4x.org
Wed Sep 4 08:24:37 CEST 2013


Thanks for the hint, it didn't work but your excerpt from the doc was
helpful.

I added event->accept() in QEvent::DragEnter and returned true, this works
now. I was wrongly assuming that the value returned by eventFilter was
passed to event->setAccepted() by the caller.

Thanks,

Etienne


2013/9/4 Alex Malyushytskyy <alexmalvtk at gmail.com>

> I have not used drag and drop features myself, so I might be wrong,
> but returning true in event handler means that event is stopped/ignored
> and
> according to QWidget::dragEnterEvent documentation:
>
> "If the event is ignored, the widget won't receive any drag move events<http://qwidget.html#dragMoveEvent>
> ."
>
> try to return false:
>
> if(event->type()==QEvent::DragEnter){	info("Enter!");
> 	return false;
> }else if(event->type()==QEvent::DragLeave){	info("Leave!");
> 	return false;}
>
>
>
>
> On Mon, Sep 2, 2013 at 1:41 AM, Etienne Sandré-Chardonnal <
> etienne.sandre at m4x.org> wrote:
>
>> Hi,
>>
>> I'm still experimenting Drag&Drop. I have experience in Qt since 2002 but
>> this is the first time I am trying drag & drop...
>>
>> In my main widget, I have a dragDropZone widget which is the active
>> dropping zone.
>>
>> In the main widget constructor, I call:
>>
>> ui->dragDropZone->setAcceptDrops(true);
>>
>> ui->dragDropZone->installEventFilter(this);
>>
>>
>> Then in the event filter:
>>
>> if(event->type()==QEvent::DragEnter){	info("Enter!");	return true;}else if(event->type()==QEvent::DragLeave){	info("Leave!");	return true;}
>>
>> But I get only "Enter!" messages.
>>
>>
>> Does another event take precedence over dragleave if accepted?
>>
>> Thanks!
>>
>> Etienne
>>
>>
>>
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
>>
>>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130904/0a7a70ee/attachment.html>


More information about the Interest mailing list