[Qt-interest] how to discard mousePressEvent in mouseDoubleClickEvent

Diego Schulz dschulz at gmail.com
Tue Apr 21 16:54:28 CEST 2009


On Tue, Apr 21, 2009 at 10:35 AM, Yifei Li <yifli at mtu.edu> 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)'?
>
> 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
>>
>


How about subclassing the widget and handling the event as you need?

regards,

diego




More information about the Qt-interest-old mailing list