Hi, I try the following codes to track the mouse outside the application, and when the mouse enters a specific rect (just enter, no click), show the application mainwindow; and move the mainwindow out of the screen when the mouse leave tha specific area:
Qt Code:
  1. void MainWindow::mouseMoveEvent(QMouseEvent *event)
  2. {
  3. qDebug() << "mouse move tracked!!";
  4. QPoint mousePoint = event->globalPos();
  5. int x = mousePoint.x();
  6. int y = mousePoint.y();
  7. qDebug() << x << ',' << y;
  8. QRect deskRect = screen.screenGeometry();
  9. int width = this->frameGeometry().width();
  10. int height = this->frameGeometry().height();
  11. if(x > (deskRect.width() - width) && y < 5)
  12. {
  13. this->move(deskRect.width() - width, 0);
  14. event->accept();
  15. // return;
  16. }
  17. if(x < (deskRect.width() - width) || y > height)
  18. {
  19. this->move(deskRect.width() - width, -height);
  20. event->accept();
  21. }
  22. }
To copy to clipboard, switch view to plain text mode 

But the problem is, when I move the mouse outside the mainwindow, there is no MouseMoveEvent, and this function is never called.
why??