QToolButton Leave Event on Mouse Leave QToolButton
Hi
I have multiple qtoolbutton in a class inherited from qwidget. when mouse is move on that they show their respective menu. i have implemented eventfilters. my code work fine in QT4 but not works fine in QT5. Onclick it works fine but not on mouse move. as per documented i set MouseTracking on.
Code:
class myClass: public QWidget
{
setMouseTracking(TRUE);
........ 8 QToolButtons
QToolButton->installEventFilter(this);
}
bool myClass::eventFilter(QObject *obj, QEvent *event)
{
if(event->type()==QEvent::Enter)
{
if(obj == toolbutton1)
showMenu1()
// same for all tool button
return true;
}
return QWidget::event(obj,event);
}
i printed qDebug it shows leaveEvent not called on mouse move. it just called on Mouse click.
Re: QToolButton Leave Event on Mouse Leave QToolButton
Have you enabled mouse tracking on the buttons?
Cheers,
_
Re: QToolButton Leave Event on Mouse Leave QToolButton
Quote:
Originally Posted by
anda_skoa
Have you enabled mouse tracking on the buttons?
Cheers,
_
Yes I enabled mouse tracking. also i tried to reimplement Leave Event. but achieve nothing. Leave Event only called on Mouse Click. Not work on mouse leave qtoolbutton boundary. it works in QT4. but not in QT5
Re: QToolButton Leave Event on Mouse Leave QToolButton
Could be related to showing the menu.
Do you get a leave event if you do not show the menu?
If so you might need to track enter/leave for the menu
Cheers,
_
Re: QToolButton Leave Event on Mouse Leave QToolButton
Quote:
Originally Posted by
anda_skoa
Could be related to showing the menu.
Do you get a leave event if you do not show the menu?
If so you might need to track enter/leave for the menu
Cheers,
_
Yes, without menu it's work fine. leave event called. how its works fine with show/hide menu.
Re: QToolButton Leave Event on Mouse Leave QToolButton
You could try adding Leave tracking to the menu.
Cheers,
_
Re: QToolButton Leave Event on Mouse Leave QToolButton
Quote:
Originally Posted by
anda_skoa
You could try adding Leave tracking to the menu.
Cheers,
_
Not getting any leave tracking of the menu.