JMouseMonitorThread.h 1023 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. // *****************************************************************************
  2. // 版权所有(C)2023~2099 上海骄成超声波技术有限公司
  3. // 保留所有权利
  4. // *****************************************************************************
  5. // 作者 : 杨坚
  6. // 版本 : 1.0
  7. // 功能说明:
  8. // 鼠标监控-全局的,可能后面还有其他地方使用,所以..
  9. // *****************************************************************************
  10. #include <QThread>
  11. #include <QMutex>
  12. #include <QStack>
  13. #include <QCursor>
  14. #include <QWidget>
  15. class JMouseMonitorThread : public QThread {
  16. Q_OBJECT
  17. public:
  18. explicit JMouseMonitorThread(QObject* parent = nullptr);
  19. void setLockCenter(const QPoint center);
  20. void unlock();
  21. void stop();
  22. signals:
  23. void MouseMovedSlg(const QPoint& delta);
  24. void RequestCursorMoveSlg(const QPoint& pos);
  25. protected:
  26. void run() override;
  27. private:
  28. QMutex m_mutex;
  29. QPoint m_lockCenter;
  30. bool m_locked;
  31. bool m_running;
  32. };