[Qt-interest] how to discard mousePressEvent in mouseDoubleClickEvent
Girish Ramakrishnan
girish at forwardbias.in
Tue Apr 21 18:02:39 CEST 2009
Hi,
Yifei Li wrote:
> Girish,
>
> My program allows users to create and modify Bezier curves. Users can
> add new control points by single clicks, and a double click indicates
> the point being added is the last one.
>
> So if I understand you correctly, there's no function call like
> 'disableEvent(mousePressEvent)'?
>
Yes, that's correct. You have probably guessed why - If Qt were to
dispatch mousePressEvent only after it is sure that it is a single
click, then it will have to wait for double click interval. In your
case, mouseReleaseEvent can be used to add a point and doubleClickEvent
can be used to complete the curve.
Girish
> Thanks
>
> Yifei
> Girish Ramakrishnan wrote:
>> Yifei Li wrote:
>>
>>> Hi all,
>>>
>>> According to the document, widgets get a mousePressEvent and
>>> mouseReleaseEvent before mouseDoubleClickEvent.
>>>
>>> I'm wondering if it's possible to discard
>>> mousePressEvent/mouseReleaseEvent in mouseDoubleClickEvent?
>>>
>>>
>>
>> Nope, it's too late to discard them since they have already been
>> delivered by the time mouseDoubleClickEvent() is called. In general, a
>> widget that processes double clicks ignores single clicks, so there is
>> really no need to process mousePress/release in the first place. What
>> exactly is the problem you are trying to solve?
>>
>> Girish
>>
More information about the Qt-interest-old
mailing list