Left Mouse press click not generated
-
HI,
I Have an application in which i want to capture the coordinates of mouse when i clicked mouse's left button. But its not working for left click while its working fine for right button. My mousePressEvent implementation is as follow:
@
void MyClassName::mousePressEvent(QMouseEvent *event)
{
qDebug()<<"x->"<<event->pos().x()<<", y->"<<event->pos().y();}@
with this code if i click right buttn position of x & y get displayed but not in case of left click because mousePressEvent(QMouseEvent *event) not getting hit.
So please give me suggestion for that
Rgds
Pardeep Sharma -
Hi Pardeep Sharma,
Use this code in ::mousePressEvent(QMouseEvent *event)
it works only if left mouse button is down
if (event->button() == Qt::LeftButton) { // **left click code**.... }