Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. EventFilter issue : left mouse press is not directly catched (got RequestSoftwareInputPanel instead, type=199)
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 2.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    helferthomas
    wrote on last edited by
    #1

    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 :

    @
    #include<QtCore/QDebug>
    #include<QtCore/QEvent>

    #include<QtGui/QKeyEvent>
    #include<QtGui/QTextEdit>
    #include<QtGui/QApplication>

    struct EventFilter
    : public QObject
    {

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

    };

    struct MyTextEdit
    : public QTextEdit
    {

    MyTextEdit(EventFilter&e)
    {
    this->installEventFilter(&e);
    }

    };

    int main(int argc,
    char **argv)
    {
    QApplication a(argc,argv);
    EventFilter ef;
    MyTextEdit e(ef);
    e.show();
    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.

    1 Reply Last reply
    1
    • H Offline
      H Offline
      helferthomas
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved