1
0
mirror of https://gitee.com/drabel/LibQQt.git synced 2025-01-04 10:18:44 +08:00
LibQQt/test/testmouselocker11/qqtframemouselocker.h

42 lines
1.3 KiB
C
Raw Normal View History

#ifndef QQTFRAMEMOUSELOCKER_H
#define QQTFRAMEMOUSELOCKER_H
#include <QObject>
#include <QWidget>
/**
* @brief The QQtFrameMouseLocker class
*
*
* 使
* QWidget* w;//需要锁定鼠标的窗口。
* w->setMouseTracking(True);//必要
* //w->setFocusPolicy(Qt::StrongFocus);//不必要设置Focus。
* QQtFrameMouseLocker* helper = new QQtFrameMouseLocker(parent) ;
* w->installEventFilter(helper);//一步设置即可。
* 使
*
*
* move的时候
* QWidgetQMainWindow
* windowsmacOSLinux
*/
class QQtFrameMouseLocker : public QObject
{
Q_OBJECT
public:
QQtFrameMouseLocker ( QObject* parent = 0 );
virtual ~QQtFrameMouseLocker();
// QObject interface
public:
virtual bool eventFilter ( QObject* watched, QEvent* event ) override;
protected:
virtual void focusInEvent ( QFocusEvent* event, QWidget* target = 0 );
virtual void focusOutEvent ( QFocusEvent* event, QWidget* target = 0 );
virtual void mouseMoveEvent ( QMouseEvent* event, QWidget* target = 0 );
};
#endif // QQTFRAMEMOUSELOCKER_H