Ai
81 Star 380 Fork 168

LibQQt应用程序开发组织/LibQQt

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
qqtevent.h 1.83 KB
一键复制 编辑 原始数据 按行查看 历史
tianduanrui 提交于 2019-10-12 17:21 +08:00 . 更新qqtwidgets里的move系列函数
#ifndef QQTEVENT_H
#define QQTEVENT_H
#include <QEvent>
#include <QMouseEvent>
#include "qqt-qt.h"
#include <qqt-local.h>
/**
* @brief The QQtMouseEvent class
* 在QQtDoubleClickeHelper里面用于保存鼠标事件对象。
*/
class QQTSHARED_EXPORT QQtMouseEvent : public QMouseEvent
{
public:
QQtMouseEvent() :
QMouseEvent ( MouseButtonPress, QPointF(), QPointF(), QPointF(),
Qt::LeftButton, Qt::LeftButton, Qt::NoModifier ) {
}
virtual ~QQtMouseEvent() {}
public:
//设置
QQtMouseEvent& operator= ( const QMouseEvent& other ) {
QQtMouseEvent& ref = *this;
ref.setType ( other.type() );
ref.localPos() = other.localPos();
ref.windowPos() = other.windowPos();
ref.screenPos() = other.screenPos();
#ifndef QT_NO_INTEGER_EVENT_COORDINATES
ref.pos() = other.pos();
ref.globalPos() = other.globalPos();
#endif
ref.button() = other.button();
ref.buttons() = other.buttons();
ref.setModifiers ( other.modifiers() );
//source 无解
return ref;
}
//读取
#ifndef QT_NO_INTEGER_EVENT_COORDINATES
inline QPoint& pos() { return _l; }
inline QPoint& globalPos() { return _s; }
inline int& x() { return _l.rx(); }
inline int& y() { return _l.ry(); }
inline int& globalX() { return _s.rx(); }
inline int& globalY() { return _s.ry(); }
#endif
QPointF& localPos() { return l; }
QPointF& windowPos() { return w; }
QPointF& screenPos() { return s; }
inline Qt::MouseButton& button() { return b; }
inline Qt::MouseButtons& buttons() { return mouseState; }
//inline Qt::MouseEventSource& source() { return sou}
//inline Qt::MouseEventFlags& flags();
inline void setType ( const Type& _t ) { t = _t; }
protected:
QPoint _l, _w, _s;
};
#endif // QQTEVENT_H
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C/C++
1
https://gitee.com/drabel/LibQQt.git
git@gitee.com:drabel/LibQQt.git
drabel
LibQQt
LibQQt
master

搜索帮助