September 27, 2010

Jackbauer24 Jackbauer24
Lab Rat
1 posts

How to get mousePressEvent by parent widget?

 

I placed QCommnadLinkButton on the parent widget.
But I can’t make the parent widget to get mousePressEvent at QCommnadLinkButton.
Is is impossible?

2 replies

September 27, 2010

Alexander Kuchumov Alexander Kuchumov
Lab Rat
377 posts

  1. (QCommandLinkButton object)->installEventFilter(parent widget object);
  2.  
  3.  bool Parent Widget Object::eventFilter(QObject *obj, QEvent *event)
  4.  {
  5.          //add here event handlet
  6.          return QObject::eventFilter(obj, event);
  7.      }
  8.  }

But, why do you want to do this?

September 27, 2010

Jackbauer24 Jackbauer24
Lab Rat
1 posts

Thank you very much!

Your suggestion is very helpful.
And I should reconsider my approach.

I want to move QCommnadLinkButton by drag.
But I should define the change of location in subclass inherited from QCommnadLinkButton, shouldn’t you?

I will try and apologize for my poor skill.

 
  ‹‹ QAxObject->dynamicCall() throws Type Mismatch (Solved)      Non-Ascii characters in Windows console ››

You must log in to post a reply. Not a member yet? Register here!