Hey there, I'm working on getting an event filter to work. It's supposed to capture all mouse events and then route them to all of it's children. I figured an efficient way to do this was to install an eventfilter which is coded like so:
{
//capture all mouse events
if(e->type() >= 2 && e->type() <= 5)
{
QList<QObject*> list(obj->children()); //get list of children
int lsize = list.size(); //list size...
for(int i=0;i<lsize;i++) //for each child
list[i]->event(e); //hand it a copy of the event
return true;
}
return false;
}
bool UIEventFilter::eventFilter(QObject *obj,QEvent *e)
{
//capture all mouse events
if(e->type() >= 2 && e->type() <= 5)
{
QList<QObject*> list(obj->children()); //get list of children
int lsize = list.size(); //list size...
for(int i=0;i<lsize;i++) //for each child
list[i]->event(e); //hand it a copy of the event
return true;
}
return false;
}
To copy to clipboard, switch view to plain text mode
The problem is, it seems to only hand of mouseReleaseEvent()s. it *might* be handing off mouse-presses, but it's definitely not handing off mouse-move events.
If you can tell why I'd be quite appreciative if you let me know
Bookmarks