#ifndef PLCDOCUMENT_H #define PLCDOCUMENT_H #include "basedocument.h" #include #include class PLCDocument : public BaseDocument { Q_OBJECT public: explicit PLCDocument(QWidget *parent = nullptr); ~PLCDocument() override; QString title() const override; QGraphicsView *view() const { return m_view; } QGraphicsScene *scene() const { return m_scene; } bool saveToFile(const QString &filePath) override; bool loadFromFile(const QString &filePath) override; private: void createGridBackground(); void createGridPattern(); QGraphicsScene *m_scene; QGraphicsView *m_view; QPixmap m_gridPattern; // 网格图案缓存 int m_gridSize = 20; // 网格大小(像素) }; #endif // PLCDOCUMENT_H