75 lines
2.7 KiB
C++
75 lines
2.7 KiB
C++
#ifndef PROJECTMODELDLG_H
|
||
#define PROJECTMODELDLG_H
|
||
|
||
#include <QDialog>
|
||
#include <QStandardItemModel>
|
||
#include <QItemSelection>
|
||
|
||
QT_BEGIN_NAMESPACE
|
||
namespace Ui { class projectModelDlg; }
|
||
QT_END_NAMESPACE
|
||
|
||
struct PropertyPage //属性列表信息
|
||
{
|
||
QStandardItemModel* pBase; //基础属性
|
||
QStandardItemModel* pSelect; //已选择属性
|
||
QMap<QString,bool> mCheckState; //属性选择状态
|
||
};
|
||
|
||
typedef QMap<QString,PropertyPage> MapProperty; //str为属性名,model1基础属性,model2已选择属性
|
||
struct PropertyModel //工程模
|
||
{
|
||
MapProperty mapProperty;
|
||
int nType; //工程模类型,选择图标后确定
|
||
};
|
||
typedef QMap<QString,PropertyModel> MapProject; //str为工程名,property为属性集
|
||
typedef QMap<QString,MapProject> MapMeta; //str为元模名,project为工程模集
|
||
|
||
class RenameModel;
|
||
|
||
class projectModelDlg : public QDialog
|
||
{
|
||
Q_OBJECT
|
||
|
||
public:
|
||
projectModelDlg(QWidget *parent = nullptr);
|
||
~projectModelDlg();
|
||
|
||
void initial();
|
||
void initialModel();
|
||
void initialList();
|
||
MapProperty addNewProject(const QString& sMeta,const QString& sProject); //根据元模型、工程模名称生成工程模对象
|
||
void update();
|
||
void generate(const QString&); //根据输入名称生成表
|
||
|
||
QString getProjectName() const; //返回当前选择项目的名称
|
||
public slots:
|
||
void onSaveClicked();
|
||
void onCancelClicked();
|
||
void onGenerateClicked();
|
||
void onApplyClicked();
|
||
void onRevokeClicked();
|
||
void onBaseModelIndexChanged(const QString&);
|
||
void onProjectIndexChanged(const QString&);
|
||
void onPropertyIndexChanged(const QString&);
|
||
void onIconClicked(const QModelIndex &index); //关联图元改变
|
||
public:
|
||
QStringList getModelList() const; //获取元模型列表
|
||
QStringList getGroupList(const QString& model) const; //返回该元模下的属性组列表
|
||
QStringList getAttributeList(const QString& model,const QString& group) const; //根据元模名和组名返回属性列表
|
||
void setItemAttribute(const QString&,QStandardItem*); //设置item的属性(数据库表字段名)
|
||
QString combinePropertySql(const QStandardItem*); //根据item属性生成sql
|
||
private:
|
||
void updateIconList(); //选择工程模后刷新关联图标
|
||
private:
|
||
Ui::projectModelDlg *ui;
|
||
RenameModel* m_pRenameModel;
|
||
QStandardItemModel* _viewModel; //索引view模型
|
||
MapMeta m_mapTotal;
|
||
QString _curMeta; //当前元模型
|
||
QString _curProject; //当前工程模
|
||
QString _curProperty; //当前属性
|
||
};
|
||
|
||
#endif
|