[Qt-interest] the code in mouseMoveEvent() does't run

yanqzhi at gmail.com yanqzhi at gmail.com
Fri Dec 25 10:19:31 CET 2009


hello, 

I want to a application run as bellow:

When the mouse moves on a window, the code in the function mouseMoveEvent will run;

I have a cod as bellow, but code does not run when no buttons is pressed.

#include <QPoint>
#include "autohide.h"
AutoHide::AutoHide(QWidget *parent, Qt::WFlags flags)
 : QMainWindow(parent, flags)
{
 ui.setupUi(this);
 Qt::WFlags wFlags = windowFlags();
 wFlags |= Qt::WindowStaysOnTopHint;
  setWindowFlags(wFlags);
 setMouseTracking ( true );
 mHide = false;
}
void AutoHide::mouseMoveEvent(QMouseEvent *e)
{
 int x = e->globalPos().x();
}

The version of Qt is 4.5

Thanks a lot.

Sincerely yours, 

yanqzhi at gmail.com 
2009-12-25 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091225/0588ecd8/attachment.html 


More information about the Qt-interest-old mailing list