Click event not catch by eventFilter
-
Hi Guys
I've been trying to fix a bug in our app which doesn't make any sense. I have a dialog which it's a color picker. There we have implemented an eyedropper which works (almost) fine and where we can pick any color around the screen. The problem we have happens in macOS.
we are doing some tile:
- calling installEventFilter() in my eyedropper class
- calling grabMouse() to get all mouse events inside of it
- capture each mouse event in the eventFiler() method
now, the problem I have is that the only mouse event which I cannot catch is the left click, and I know that because my eventFilter method looks like this:
bool MyColorEyeDropper::eventFilter(QObject *object, QEvent *event) { if (event->type() == QEvent::MouseButtonPress) { QMouseEvent * mouseEvent = dynamic_cast<QMouseEvent*>(event); switch(mouseEvent->button()) { case Qt::LeftButton: cout << "Left click !!" << endl; break; case Qt::RightButton: cout << "Right click !!" << endl; break; default: cout << "Something else !!" << endl; break; } } return false; }
and Left click !! never happens... do you have any idea where should I take a look? Because as far as I know, if I call grabMouse, all events will be catch by this widget till I call releaseMouse. Am I wrong?
Regards
-
Hi,
What version of Qt ?
What version of macOS ?Can you provide a minimal compilable example that shows that behaviour ?
-
@SGaist thanks for replying... I'm running our app on macOS 10.15.5 and we are using Qt 5.12.8.
Regards
-
I don't have that macOS version at hand but if you provide a minimal compilable example, I can test it on my machine nonetheless.