代码拉取完成,页面将自动刷新
同步操作将从 zhangheyang/LVGLBuilder 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#ifndef LVGLSIMULATOR_H
#define LVGLSIMULATOR_H
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QTextStream>
#include "lvgl/lvgl.h"
class LVGLObject;
class LVGLItem;
class LVGLObjectModel;
class LVGLPropertyModel;
class LVGLScene : public QGraphicsScene {
Q_OBJECT
public:
LVGLScene(QObject *parent = nullptr);
LVGLObject *selected() const;
LVGLObject *hoverObject() const;
void setHoverObject(LVGLObject *hoverObject);
public slots:
void setSelected(LVGLObject *selected);
protected:
virtual void drawBackground(QPainter *painter, const QRectF &rect) override;
private:
LVGLObject *m_selected;
LVGLObject *m_hoverObject;
};
class LVGLSimulator : public QGraphicsView {
Q_OBJECT
public:
explicit LVGLSimulator(QWidget *parent = nullptr);
~LVGLSimulator() override;
LVGLObject *selectedObject() const;
LVGLItem *item() const;
void moveObject(LVGLObject *obj, int dx, int dy);
void addObject(LVGLObject *obj);
void removeObject(LVGLObject *obj);
void setObjectModel(LVGLObjectModel *objectModel);
void setPropertyModel(LVGLPropertyModel *propertyModel);
void setobjParent(lv_obj_t *parent);
public slots:
void setSelectedObject(LVGLObject *obj);
void setZoomLevel(int level);
void clear();
void setMouseEnable(bool enable);
void changeResolution(QSize size);
signals:
void objectSelected(LVGLObject *obj);
void objectPositionChanged();
void objectAdded(LVGLObject *obj);
protected:
void mousePressEvent(QMouseEvent *event) override;
void mouseDoubleClickEvent(QMouseEvent *event) override;
void mouseReleaseEvent(QMouseEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
void dropEvent(QDropEvent *event) override;
void dragMoveEvent(QDragMoveEvent *event) override;
void dragEnterEvent(QDragEnterEvent *event) override;
private slots:
void update();
private:
LVGLObject *selectObject(QList<LVGLObject *> objs, bool doubleClick) const;
QList<LVGLObject *> objectsUnderCoords(QPoint pos, bool includeLocked) const;
void generateCodeObject(QTextStream &stream, LVGLObject *o);
// void parseJson(QJsonObject object, LVGLObject *parent = nullptr);
LVGLScene *m_scene;
LVGLObject *m_selectedObject;
bool m_mouseEnabled;
LVGLItem *m_item;
LVGLObjectModel *m_objectModel;
lv_obj_t *m_parent;
LVGLPropertyModel *m_propertyModel;
};
class LVGLKeyPressEventFilter : public QObject {
Q_OBJECT
public:
explicit LVGLKeyPressEventFilter(LVGLSimulator *sim,
QObject *parent = nullptr);
protected:
bool eventFilter(QObject *obj, QEvent *event) override;
private:
LVGLSimulator *m_sim;
};
#endif // LVGLSIMULATOR_H
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。