2025-06-06 18:57:37 +08:00
|
|
|
#ifndef PROJECTMODELMANAGER_H
|
|
|
|
|
#define PROJECTMODELMANAGER_H
|
|
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
#include <QMap>
|
|
|
|
|
#include "export.hpp"
|
|
|
|
|
#include "global.h"
|
|
|
|
|
/****工程模管理类*****/
|
|
|
|
|
|
|
|
|
|
class DIAGRAM_DESIGNER_PUBLIC ProjectModelManager : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
explicit ProjectModelManager(QObject *parent = nullptr);
|
|
|
|
|
~ProjectModelManager();
|
|
|
|
|
|
|
|
|
|
static ProjectModelManager& instance();
|
|
|
|
|
public:
|
|
|
|
|
void initialModel();
|
|
|
|
|
void generate(const QString& sMeta,const QString& sPro); //根据输入名称生成表
|
|
|
|
|
MapProperty addNewProject(const QString& sMeta,const QString& sProject,PropertyModel&); //根据元模型、工程模名称生成工程模对象
|
|
|
|
|
QList<QStandardItem*> getGroupSub(QStandardItemModel*,const QString&); //返回指定组下的属性(如果存在)
|
|
|
|
|
MapMeta& getData() {return m_mapTotalData;}
|
|
|
|
|
void deleteData(const QString& meta,const QString& proj);
|
2025-06-27 19:17:04 +08:00
|
|
|
void updateSetting(const QString& sMeta,const QString& sPro); //更新模型数据(图片
|
|
|
|
|
QStringList getProjectModelLst(const QString& sMeta);
|
2025-06-06 18:57:37 +08:00
|
|
|
public:
|
|
|
|
|
QStringList getModelList() const; //获取元模型列表
|
|
|
|
|
QStringList getGroupList(const QString& model) const; //返回该元模下的属性组列表
|
|
|
|
|
QStringList getPublicGroupList() const; //返回公共属性组列表
|
|
|
|
|
QStringList getAttributeList(const QString& model,const QString& group) const; //根据元模名和组名返回属性列表
|
|
|
|
|
QStringList getPublicAttributeList(const QString& group); //返回公共属性组的属性列表
|
|
|
|
|
void setItemAttribute(const QString&,QStandardItem*); //设置item的属性(数据库表字段名)
|
|
|
|
|
QPair<QString,QString> combinePropertySql(const QStandardItem*); //根据item属性生成sql
|
|
|
|
|
bool ifProjectEqual(const QString& sMeta,const QString& sPro,QMap<QString,QJsonObject>); //根据每个属性组的勾选状态判断两个模型是否相同
|
|
|
|
|
QString modifyProjectModel(const QString& sMeta,const QString& sProject,QMap<QString,QJsonObject>); //修改工程模
|
|
|
|
|
bool renameProjectModel(const QString& strCur,QMap<QString,projectManager> datas); //重命名工程模
|
|
|
|
|
void updateComponentModelName(const QString& strOld,const QString& strNew); //更新component中的工程模
|
|
|
|
|
bool ifProjectExsit(const QString&); //判断工程模存在
|
|
|
|
|
signals:
|
|
|
|
|
void modelChange(); //模型改变信号
|
|
|
|
|
private:
|
2025-07-23 17:27:35 +08:00
|
|
|
int createPropertyTable(const QString& sMeta,const QString& sProject,const QString& sGroup,QList<QStandardItem*> lstSelect,QList<QStandardItem*> lstBase,int nLinkType,bool isPublic); //创建属性组表并插入记录到管理表(工程名,当前项迭代器,关联图元类型)
|
2025-06-06 18:57:37 +08:00
|
|
|
QJsonObject getSelectedState(QList<QStandardItem*> select,QList<QStandardItem*> base); //返回json格式的选中状态
|
|
|
|
|
QString getItemDataType(const QStandardItem* pItem); //返回数据类型
|
2025-06-27 19:17:04 +08:00
|
|
|
projectModelSetting getModelSetting(const QString& sMeta,const QString& sProject); //获取指定工程模的设定
|
2025-06-06 18:57:37 +08:00
|
|
|
private:
|
|
|
|
|
MapMeta m_mapTotalData;
|
|
|
|
|
bool _bInitialised;
|
|
|
|
|
};
|
|
|
|
|
#endif // PROJECTMODELMANAGER_H
|