[Qt-interest] No mouse relase event

Nikos Chantziaras realnc at arcor.de
Fri Dec 17 10:49:45 CET 2010


On 12/17/2010 11:02 AM, Zhongmiao Li wrote:
> Hello everyone,
>
> I display a widget inside another widget and I  inherited its  mouse
> event handler
>
>      public  void mouseMoveEvent(QMouseEvent e)
>      {
>          env.handleEvent(this, e);
>      }
>
>      public void mousePressEvent(QMouseEvent e)
>      {
>          env.handleEvent(this, e);
>      }
>
>      public void mouseReleaseEvent(QMouseEvent e)
>      {
>          env.handleEvent(this, e);
>      }
>
> However, the mouseReleaseEvent  is never trigged, while the other two is
> working normally. So do you know what causes that problem? Thanks very much!

This looks wrong to me.  You cannot inherit functions of another widget. 
  In C++, you can only inherit functions from the widgets base class.

Also, the function signatures are wrong.  First, the handlers are all 
protected, not public.  Second, the parameter of those handlers is a 
QMouseEvent*, not a QMouseEvent (that is, it's a pointer, not an instance.)

Hope that helps.



More information about the Qt-interest-old mailing list