Important: Please read the Qt Code of Conduct -

EventFilter issue : left mouse press is not directly catched (got RequestSoftwareInputPanel instead, type=199)

  • Hi,

    my name is Helfer Thomas. I am working on a personal project using Qt. I am using Qt 4.6 on a debian squeeze in a gnome environment.

    I am trying to filter mouse event send to a QTextEdit. I could easily handle event associated with the right button, but have some trouble with the left one : when clicking on the QTextEdit, I receive an QEvent of type 199 (RequestSoftwareInputPanel). Googling taugh we was it meant, but I could not figure out how it is converted to a QMouseEvent by a standard QWidget.

    The following code snippets illustrate my trouble :



    struct EventFilter
    : public QObject

    virtual bool
    eventFilter(QObject *,
    QEvent *e)
    qDebug() << e;
    return false;


    struct MyTextEdit
    : public QTextEdit



    int main(int argc,
    char **argv)
    QApplication a(argc,argv);
    EventFilter ef;
    MyTextEdit e(ef);;
    return QApplication::exec();

    A right click on the QTextEdit leads to :
    QMouseEvent(MouseButtonPress, 2, 2, 0)
    A left click lead to :
    QEvent(0x7fffb17d1be0, type = 199)

    Can I consider that such an event is always associated to a left button press ?

    Thank for any help.

  • I received an answer to my question through the qt mailing list.

    The solution is to install an event filter on the QTextEdit viewport.

    Thank for reading my post

Log in to reply