selectively ignoring mouse events in Qt

I am writing an application that gets input from 3 mice. 2 of the mice are used for gestures and their input is handled separately, the 3rd should function as normal. I have successfully installed an eventfilter (see below) that runs my own mouse-processing code (processMouse()).

However, when trying to get the filter to ignore the events from certain mice (determined by the boolean return value of processMouse()), nothing gets ignored.

I have tried using the normal true/false return values, resetting the event to a "None" event, calling it's ignore function, but the mouse still keeps moving even when I tell it to ignore the event.

bool MainWindow::eventFilter(QObject *obj, QEvent *event){
    if ((event->type() == QEvent::MouseMove) ||
        (event->type() == QEvent::MouseButtonPress)){
        if (configured){
            if (!processMouse()){
                //event->ignore();
                //event = new QEvent(QEvent::None);
            }
        }
        return true;

    }
    return false;
}

How can I selectively ignore MouseMove events from an eventfilter?

Answers


This was eventually solved by using a 3rd party library named "ManyMouse", which receives each mouse's input separately.


Need Your Help

How Do You Keep UML Diagrams Up To Date?

java uml

I am from a Physics background and not a Computer Science background and never did any course at University on class/component diagrams etc and I have never found the need to use them at work.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.