Thank you at lot, its works !

----- Mail original -----
De: "j-p nurmi" <j-p.nu...@nokia.com>
À: interest@qt-project.org
Cc: helfertho...@free.fr
Envoyé: Mardi 11 Septembre 2012 08:12:24
Objet: Re: [Interest] eventFilter issue : left mouse press is not directly 
catched (got RequestSoftwareInputPanel instead, type=199)

On Sep 11, 2012, at 7:49 AM, ext helfertho...@free.fr <helfertho...@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

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to