Quantcast
Channel: User spraff - Stack Overflow
Viewing all articles
Browse latest Browse all 55

Why isn't my Qt eventFilter picking up mouse events on a QTreeWidget?

$
0
0

I have basically this code to intercept certain QTreeWidget events.

MyWidget :: MyWidget (){     m_tree = new QTreeWidget ();     // ...     m_tree -> installEventFilter (this);}bool MyWidget :: eventFilter (QObject * obj, QEvent * e){    if (m_tree != obj)        return QWidget :: eventFilter (obj, e);    qDebug () << e -> type ();    switch (e -> type ())    {        case QEvent :: MouseButtonPress:        case QEvent :: MouseButtonRelease:        case QEvent :: MouseMove:        case QEvent :: Leave:            qDebug () << "GOT EM";            break;    };    // ... }

As I click and move around in the QTreeWidget, the event handler prints out e->type() for lots of events, but not the mouse events. Mouse events appear never to happen (with the exception of Leave).

Why is this happening? I should be getting move events even with mouse tracking off provided at least one button is down, and I should be getting press and release events regardless. The QTreeWidget itself behaves normally, as if no event handler is installed.


Viewing all articles
Browse latest Browse all 55

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>