1 Star 0 Fork 15

sspemail/LVGLBuilder

forked from zhangheyang/LVGLBuilder 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
LVGLItem.h 1.29 KB
一键复制 编辑 原始数据 按行查看 历史
#ifndef LVGLITEM_H
#define LVGLITEM_H
#include <QGraphicsItem>
#include "LVGLObject.h"
class LVGLItem : public QObject, public QGraphicsItem
{
Q_OBJECT
Q_INTERFACES(QGraphicsItem)
public:
LVGLItem(QGraphicsItem *parent = nullptr);
QRectF boundingRect() const override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
LVGLObject *object() const;
void setObject(LVGLObject *obj);
bool isManipolating() const;
signals:
void geometryChanged();
public slots:
void updateGeometry();
protected:
QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;
void hoverMoveEvent(QGraphicsSceneHoverEvent *event) override;
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
private:
struct ResizeDirections
{
enum { HorzNone, Left, Right } horizontal;
enum { VertNone, Top, Bottom } vertical;
bool any() const { return horizontal || vertical; }
void clear() { horizontal = HorzNone; vertical = VertNone; }
};
LVGLObject *m_object;
QRectF m_start;
ResizeDirections m_direction;
lv_coord_t m_minimumWidth;
lv_coord_t m_minimumHeight;
};
#endif // LVGLITEM_H
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/sspemail/LVGLBuilder.git
git@gitee.com:sspemail/LVGLBuilder.git
sspemail
LVGLBuilder
LVGLBuilder
master

搜索帮助