Hi, my name is Helfer Thomas and I am using Qt for a free time project. I am
french and apologies for my poor english
I already described my issue on the qt forum without any reply, so I hope to
have better chance on this mailing list.
http://qt-project.org/forums/viewthread/20144/
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.
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
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 ?
Thank for any help.
Sincerly,
Helfer Thomas
/*!
* \file test-qt.cxx
* \brief
* \author Helfer Thomas
* \brief 11 sept. 2012
*/
#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();
}
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest