[Interest] eventFilter issue : left mouse press is not directly catched (got RequestSoftwareInputPanel instead, type=199)

j-p.nurmi at nokia.com j-p.nurmi at nokia.com
Tue Sep 11 08:12:24 CEST 2012


On Sep 11, 2012, at 7:49 AM, ext helferthomas at free.fr <helferthomas at free.fr> wrote:
> 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. In particular, I am not sure that receiving a RequestSoftwareInputPanel actually *always* means that the user made a left click on my QTextEdit.

Install the event filter on the viewport (see QAbstractScrollArea docs for reasoning):

textEdit->viewport()->installEventFilter(foo);

> I attached a code snipset to this mail which illustrates the issue. It can be compiled like this :
> g++ -Wall test-qt.cxx -I /usr/include/qt4 -lQtGui -o test-qt

qmake -project && qmake && make

> When running this example, the following behaviour can be observed :
> - a right click on the QTextEdit leads to QMouseEvent(MouseButtonPress, 2, 2, 0)
> - a left click lead to a QEvent(0×7fffb17d1be0, type = 199)
> 
> Can I consider that such an event is always associated to a left button press ?


Usually not a good idea to rely on such things. :)

--
J-P Nurmi




More information about the Interest mailing list