generate project model V0.2
This commit is contained in:
parent
adccf50923
commit
293be045c0
|
|
@ -46,9 +46,11 @@ set(H_HEADER_FILES
|
||||||
include/toolBox.h
|
include/toolBox.h
|
||||||
include/loadPageDlg.h
|
include/loadPageDlg.h
|
||||||
include/projectModelDlg.h
|
include/projectModelDlg.h
|
||||||
include/renameModel.h
|
include/projectTableDelegate.h
|
||||||
|
include/selectorDialog.h
|
||||||
|
|
||||||
common/include/global.h
|
common/include/global.h
|
||||||
|
common/include/tools.h
|
||||||
common/include/httpInterface.h
|
common/include/httpInterface.h
|
||||||
common/include/compiler.hpp
|
common/include/compiler.hpp
|
||||||
common/include/export.hpp
|
common/include/export.hpp
|
||||||
|
|
@ -67,7 +69,8 @@ set(CPP_SOURCE_FILES
|
||||||
source/toolBox.cpp
|
source/toolBox.cpp
|
||||||
source/loadPageDlg.cpp
|
source/loadPageDlg.cpp
|
||||||
source/projectModelDlg.cpp
|
source/projectModelDlg.cpp
|
||||||
source/renameModel.cpp
|
source/projectTableDelegate.cpp
|
||||||
|
source/selectorDialog.cpp
|
||||||
|
|
||||||
common/source/httpInterface.cpp
|
common/source/httpInterface.cpp
|
||||||
common/source/global.cpp
|
common/source/global.cpp
|
||||||
|
|
@ -77,7 +80,6 @@ set(UI_FILES
|
||||||
ui/graphicElementsPanel.ui
|
ui/graphicElementsPanel.ui
|
||||||
ui/loadPageDlg.ui
|
ui/loadPageDlg.ui
|
||||||
ui/projectModelDlg.ui
|
ui/projectModelDlg.ui
|
||||||
ui/renameModel.ui
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# 包含源文件目录
|
# 包含源文件目录
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,27 @@ enum Attribute //元模属性字段对照
|
||||||
ValueRange = Qt::UserRole + 9,
|
ValueRange = Qt::UserRole + 9,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum TableDelegateContent //代理内容
|
||||||
|
{
|
||||||
|
TD_ProjectModel = 0, //工程模
|
||||||
|
TD_MetaModel, //基模
|
||||||
|
TD_ComponentType //元件类型
|
||||||
|
};
|
||||||
|
|
||||||
|
enum SelectorDialogType //选择dialog类型
|
||||||
|
{
|
||||||
|
ST_MetaModel = 0, //元模对话框
|
||||||
|
ST_ComponentType //元件选择
|
||||||
|
};
|
||||||
|
|
||||||
|
enum TableItemState //工程模table操作的对象状态
|
||||||
|
{
|
||||||
|
TS_create = 1,
|
||||||
|
TS_select = 2,
|
||||||
|
TS_edit = 4
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
struct attributeGroup //属性组(元模)
|
struct attributeGroup //属性组(元模)
|
||||||
{
|
{
|
||||||
int id = 0;
|
int id = 0;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,67 @@
|
||||||
|
#ifndef TOOLS_H
|
||||||
|
#define TOOLS_H
|
||||||
|
|
||||||
|
#include <QHash>
|
||||||
|
|
||||||
|
template <typename Key, typename Value> //双向map工具类,实现key->value,value->key的映射
|
||||||
|
class BiDirectionalMap {
|
||||||
|
public:
|
||||||
|
// 插入键值对,确保双向唯一性
|
||||||
|
void insert(const Key& key, const Value& value) {
|
||||||
|
// 删除旧键和旧值的关联(如果存在)
|
||||||
|
if (m_keyToValue.contains(key)) {
|
||||||
|
Value oldValue = m_keyToValue[key];
|
||||||
|
m_valueToKey.remove(oldValue);
|
||||||
|
}
|
||||||
|
if (m_valueToKey.contains(value)) {
|
||||||
|
Key oldKey = m_valueToKey[value];
|
||||||
|
m_keyToValue.remove(oldKey);
|
||||||
|
}
|
||||||
|
// 插入新键值对
|
||||||
|
m_keyToValue[key] = value;
|
||||||
|
m_valueToKey[value] = key;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据键获取值
|
||||||
|
Value value(const Key& key) const {
|
||||||
|
return m_keyToValue.value(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据值获取键
|
||||||
|
Key key(const Value& value) const {
|
||||||
|
return m_valueToKey.value(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查键是否存在
|
||||||
|
bool containsKey(const Key& key) const {
|
||||||
|
return m_keyToValue.contains(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查值是否存在
|
||||||
|
bool containsValue(const Value& value) const {
|
||||||
|
return m_valueToKey.contains(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 通过键删除项
|
||||||
|
void removeByKey(const Key& key) {
|
||||||
|
if (m_keyToValue.contains(key)) {
|
||||||
|
Value value = m_keyToValue[key];
|
||||||
|
m_keyToValue.remove(key);
|
||||||
|
m_valueToKey.remove(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 通过值删除项
|
||||||
|
void removeByValue(const Value& value) {
|
||||||
|
if (m_valueToKey.contains(value)) {
|
||||||
|
Key key = m_valueToKey[value];
|
||||||
|
m_valueToKey.remove(value);
|
||||||
|
m_keyToValue.remove(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
QHash<Key, Value> m_keyToValue; // 键 → 值
|
||||||
|
QHash<Value, Key> m_valueToKey; // 值 → 键
|
||||||
|
};
|
||||||
|
#endif // DATABASE_H
|
||||||
|
|
@ -15,7 +15,7 @@ class DIAGRAM_DESIGNER_PUBLIC DataBase
|
||||||
public:
|
public:
|
||||||
DataBase();
|
DataBase();
|
||||||
~DataBase();
|
~DataBase();
|
||||||
QSqlQuery executeSQL(const QString& strSQL, bool createOrDrop = false,const QVariantList& params = {}, bool useTranscation = false);
|
QSqlQuery executeSQL(const QString& strSQL, bool isDDl = false,const QVariantList& params = {}, bool useTranscation = false); //ddl:create,delete,alter etc
|
||||||
/**
|
/**
|
||||||
* @brief 多条批量SQL语句执行接口
|
* @brief 多条批量SQL语句执行接口
|
||||||
* @param sqlStatements SQL语句列表
|
* @param sqlStatements SQL语句列表
|
||||||
|
|
@ -82,9 +82,15 @@ public:
|
||||||
QMap<QString,QString> getProjectTableName(const QString& sProject); //获取当前工程模型下所有表信息
|
QMap<QString,QString> getProjectTableName(const QString& sProject); //获取当前工程模型下所有表信息
|
||||||
bool createDynamicTable(const QString&, const QStringList&);
|
bool createDynamicTable(const QString&, const QStringList&);
|
||||||
bool deleteProjectModel(const QString&);
|
bool deleteProjectModel(const QString&);
|
||||||
|
bool updateProjectName(const QString& newTable,const QString& newPro,const QString& oldTable); //更新mangager工程模名称
|
||||||
|
bool alterTableName(const QString& oldTable,const QString& newTable); //修改表名
|
||||||
|
bool updateComponentModelName(const QString& strOld,const QString& strNew); //修改component中的模型名
|
||||||
|
|
||||||
bool deleteTable(const QString&); //删除表
|
bool deleteTable(const QString&); //删除表
|
||||||
bool deleteRecordFromManager(const QString& sProject,const QString& sGroup); //删除某个模型下的组
|
bool deleteRecordFromManager(const QString& sProject,const QString& sGroup); //删除某个模型下的组
|
||||||
bool modifyProjectTable(QString sTable,QMap<QString,QString> mOld,QMap<QString,QString> mNew);
|
bool modifyProjectTable(QString sTable,QMap<QString,QString> mOld,QMap<QString,QString> mNew);
|
||||||
|
|
||||||
|
QStringList ifModelOccupy(const QString&); //判断模型是否被使用
|
||||||
//**********使用工程模
|
//**********使用工程模
|
||||||
QMap<QString,int> getAllProjectModel(); //获取所有工程模<名称,图元类型>
|
QMap<QString,int> getAllProjectModel(); //获取所有工程模<名称,图元类型>
|
||||||
QMap<QString,propertyGroupState> getModelInfo(const QString&); //获取模型信息
|
QMap<QString,propertyGroupState> getModelInfo(const QString&); //获取模型信息
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ DataBase* DataBase::GetInstance()
|
||||||
return dbInstance;
|
return dbInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
QSqlQuery DataBase::executeSQL(const QString& strSQL,bool createOrDrop,const QVariantList& params, bool useTranscation)
|
QSqlQuery DataBase::executeSQL(const QString& strSQL,bool isDDL,const QVariantList& params, bool useTranscation)
|
||||||
{
|
{
|
||||||
//事务
|
//事务
|
||||||
bool transactionStarted = false;
|
bool transactionStarted = false;
|
||||||
|
|
@ -85,7 +85,7 @@ QSqlQuery DataBase::executeSQL(const QString& strSQL,bool createOrDrop,const QVa
|
||||||
QSqlQuery sqlQuery(db);
|
QSqlQuery sqlQuery(db);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if(createOrDrop) //创建或删除直接执行sql
|
if(isDDL) //创建或删除直接执行sql
|
||||||
{
|
{
|
||||||
if (!sqlQuery.exec(strSQL))
|
if (!sqlQuery.exec(strSQL))
|
||||||
{
|
{
|
||||||
|
|
@ -199,12 +199,12 @@ QSqlQuery DataBase::executeBatchSQL(const QStringList& sqlStatements, bool creat
|
||||||
}
|
}
|
||||||
|
|
||||||
lastQuery = std::move(sqlQuery);
|
lastQuery = std::move(sqlQuery);
|
||||||
// 提交事务(如果已开启)
|
}
|
||||||
if(transactionStarted && !db.commit())
|
// 提交事务(如果已开启)
|
||||||
{
|
if(transactionStarted && !db.commit())
|
||||||
throw std::runtime_error(db.lastError().text().toStdString());
|
{
|
||||||
LOG_ERROR("DB", QString("Commit transaction failed."));
|
throw std::runtime_error(db.lastError().text().toStdString());
|
||||||
}
|
LOG_ERROR("DB", QString("Commit transaction failed."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (const std::runtime_error& e)
|
catch (const std::runtime_error& e)
|
||||||
|
|
@ -1311,8 +1311,8 @@ QMap<QString,int> DataBase::getProjectFromManager(const QString& sMeta)
|
||||||
{
|
{
|
||||||
map.insert(tag,nType);
|
map.insert(tag,nType);
|
||||||
}
|
}
|
||||||
query.clear();
|
|
||||||
}
|
}
|
||||||
|
query.clear();
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
catch (const std::exception& e)
|
catch (const std::exception& e)
|
||||||
|
|
@ -1324,10 +1324,6 @@ QMap<QString,int> DataBase::getProjectFromManager(const QString& sMeta)
|
||||||
QMap<QString,QJsonObject> DataBase::getCheckStateFromManager(const QString& sProject)
|
QMap<QString,QJsonObject> DataBase::getCheckStateFromManager(const QString& sProject)
|
||||||
{
|
{
|
||||||
QMap<QString,QJsonObject> map;
|
QMap<QString,QJsonObject> map;
|
||||||
if(sProject == QString::fromWCharArray(L"新建"))
|
|
||||||
{
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString strSQL = "SELECT group_name, check_state FROM project_manager WHERE tag = ?";
|
QString strSQL = "SELECT group_name, check_state FROM project_manager WHERE tag = ?";
|
||||||
QVariantList params;
|
QVariantList params;
|
||||||
|
|
@ -1430,7 +1426,7 @@ QMap<QString,propertyGroupState> DataBase::getModelInfo(const QString& sProject)
|
||||||
QMap<QString,projectManager> DataBase::getProjectModelGroupInfo(const QString& sTable)
|
QMap<QString,projectManager> DataBase::getProjectModelGroupInfo(const QString& sTable)
|
||||||
{
|
{
|
||||||
QMap<QString,projectManager> map;
|
QMap<QString,projectManager> map;
|
||||||
QString strSQL = "SELECT * FROM project_manager WHERE tag = ?";
|
QString strSQL = "SELECT name,tag,meta_model,group_name,link_type,check_state FROM project_manager WHERE tag = ?";
|
||||||
QVariantList params;
|
QVariantList params;
|
||||||
params.append(sTable);
|
params.append(sTable);
|
||||||
|
|
||||||
|
|
@ -1440,13 +1436,12 @@ QMap<QString,projectManager> DataBase::getProjectModelGroupInfo(const QString& s
|
||||||
while (query.next())
|
while (query.next())
|
||||||
{
|
{
|
||||||
projectManager info;
|
projectManager info;
|
||||||
info.id = query.value(0).toInt();
|
info.name = query.value(0).toString();
|
||||||
info.name = query.value(1).toString();
|
info.tag = query.value(1).toString();
|
||||||
info.tag = query.value(2).toString();
|
info.metaModel = query.value(2).toString();
|
||||||
info.metaModel = query.value(3).toString();
|
info.groupName = query.value(3).toString();
|
||||||
info.groupName = query.value(4).toString();
|
info.linkType = query.value(4).toInt();
|
||||||
info.linkType = query.value(5).toInt();
|
QString json = query.value(5).toString();
|
||||||
QString json = query.value(6).toString();
|
|
||||||
info.checkState = QstringToJson(json);
|
info.checkState = QstringToJson(json);
|
||||||
|
|
||||||
if(!map.contains(info.groupName))
|
if(!map.contains(info.groupName))
|
||||||
|
|
@ -1527,11 +1522,6 @@ bool DataBase::createDynamicTable(const QString &tableName, const QStringList &f
|
||||||
|
|
||||||
bool DataBase::deleteProjectModel(const QString& sProject)
|
bool DataBase::deleteProjectModel(const QString& sProject)
|
||||||
{
|
{
|
||||||
if(sProject == QString::fromWCharArray(L"新建"))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList lstTable;
|
QStringList lstTable;
|
||||||
QString strSQL = "SELECT name FROM project_manager WHERE tag = ?";
|
QString strSQL = "SELECT name FROM project_manager WHERE tag = ?";
|
||||||
QVariantList params;
|
QVariantList params;
|
||||||
|
|
@ -1596,6 +1586,59 @@ bool DataBase::deleteProjectModel(const QString& sProject)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DataBase::updateProjectName(const QString& newTable,const QString& newPro,const QString& oldTable)
|
||||||
|
{
|
||||||
|
QString strSQL = QString("UPDATE project_manager SET name = ?,tag = ? WHERE name = ?");
|
||||||
|
QVariantList params;
|
||||||
|
params.append(newTable);
|
||||||
|
params.append(newPro);
|
||||||
|
params.append(oldTable);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
executeSQL(strSQL,false,params);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (const std::exception& e)
|
||||||
|
{
|
||||||
|
LOG_ERROR("DB", QString("Update project_manager %1 fail").arg(oldTable));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DataBase::alterTableName(const QString& oldTable,const QString& newTable)
|
||||||
|
{
|
||||||
|
QString strSQL = QString("ALTER TABLE %1 RENAME TO %2").arg(oldTable,newTable);
|
||||||
|
QVariantList params;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
executeSQL(strSQL,true);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (const std::exception& e)
|
||||||
|
{
|
||||||
|
LOG_ERROR("DB", QString("ALTER TABLE %1 fail").arg(oldTable));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DataBase::updateComponentModelName(const QString& strOld,const QString& strNew)
|
||||||
|
{
|
||||||
|
QString strSQL = QString("UPDATE component SET model_name = ? WHERE model_name = ?");
|
||||||
|
QVariantList params;
|
||||||
|
params.append(strOld);
|
||||||
|
params.append(strNew);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
executeSQL(strSQL,false,params);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (const std::exception& e)
|
||||||
|
{
|
||||||
|
LOG_ERROR("DB", QString("Update component model_name %1 fail").arg(strOld));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool DataBase::deleteTable(const QString& sName)
|
bool DataBase::deleteTable(const QString& sName)
|
||||||
{
|
{
|
||||||
QString strSQL = QString("DROP TABLE IF EXISTS %1").arg(sName);
|
QString strSQL = QString("DROP TABLE IF EXISTS %1").arg(sName);
|
||||||
|
|
@ -1681,3 +1724,28 @@ bool DataBase::modifyProjectTable(QString sTable,QMap<QString,QString> mOld,QMap
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStringList DataBase::ifModelOccupy(const QString& sName)
|
||||||
|
{
|
||||||
|
QStringList lst;
|
||||||
|
QMap<QString,projectManager> map;
|
||||||
|
QString strSQL = "SELECT tag FROM component WHERE model_name = ?";
|
||||||
|
QVariantList params;
|
||||||
|
params.append(sName);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
QSqlQuery query = executeSQL(strSQL,false,params);
|
||||||
|
while (query.next())
|
||||||
|
{
|
||||||
|
QString str = query.value(0).toString();
|
||||||
|
lst.append(str);
|
||||||
|
}
|
||||||
|
query.clear();
|
||||||
|
return lst;
|
||||||
|
}
|
||||||
|
catch (const std::exception& e)
|
||||||
|
{
|
||||||
|
return lst;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,34 +4,52 @@
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
#include <QItemSelection>
|
#include <QItemSelection>
|
||||||
|
#include <QTableWidgetItem>
|
||||||
|
#include "tools.h"
|
||||||
|
#include "global.h"
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
namespace Ui { class projectModelDlg; }
|
namespace Ui { class projectModelDlg; }
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
enum projectState
|
||||||
|
{
|
||||||
|
Err = -1,
|
||||||
|
NotExist = 0,
|
||||||
|
Exist,
|
||||||
|
Changed
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FormerName //曾用名,记录修改前名称
|
||||||
|
{
|
||||||
|
QString sName;
|
||||||
|
bool bChanged = false; //是否改变过
|
||||||
|
};
|
||||||
|
|
||||||
struct PropertyState //每个属性的状态
|
struct PropertyState //每个属性的状态
|
||||||
{
|
{
|
||||||
bool checkState = false;
|
bool checkState = false;
|
||||||
QString dataType;
|
QString dataType;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PropertyPage //属性列表信息
|
struct PropertyPage //属性信息
|
||||||
{
|
{
|
||||||
QStandardItemModel* pBase; //基础属性
|
|
||||||
QStandardItemModel* pSelect; //已选择属性
|
|
||||||
QMap<QString,PropertyState> mCheckState; //属性选择状态
|
QMap<QString,PropertyState> mCheckState; //属性选择状态
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef QMap<QString,PropertyPage> MapProperty; //str为属性名,model1基础属性,model2已选择属性
|
typedef QMap<QString,PropertyPage> MapProperty; //属性组
|
||||||
struct PropertyModel //工程模
|
struct PropertyModel //工程模
|
||||||
{
|
{
|
||||||
MapProperty mapProperty;
|
MapProperty mapProperty;
|
||||||
int nType = 0; //工程模类型,选择图标后确定
|
int nType = 0; //工程模类型,选择图标后确定
|
||||||
|
QStandardItemModel* pBase; //基础属性
|
||||||
|
QStandardItemModel* pSelect; //已选择属性
|
||||||
|
FormerName formerMeta; //曾用元模名
|
||||||
|
FormerName formerProject; //曾用工程模名
|
||||||
|
QMap<QString,projectManager> dataInfo; //存放数据库内容
|
||||||
};
|
};
|
||||||
typedef QMap<QString,PropertyModel> MapProject; //str为工程名,property为属性集
|
typedef QMap<QString,PropertyModel> MapProject; //str为工程名,PropertyModel为工程属性
|
||||||
typedef QMap<QString,MapProject> MapMeta; //str为元模名,project为工程模集
|
typedef QMap<QString,MapProject> MapMeta; //str为元模名,PropertyModel为工程模集
|
||||||
|
|
||||||
class RenameModel;
|
|
||||||
|
|
||||||
class projectModelDlg : public QDialog
|
class projectModelDlg : public QDialog
|
||||||
{
|
{
|
||||||
|
|
@ -44,8 +62,8 @@ public:
|
||||||
void initial();
|
void initial();
|
||||||
void initialModel();
|
void initialModel();
|
||||||
void initialList();
|
void initialList();
|
||||||
MapProperty addNewProject(const QString& sMeta,const QString& sProject); //根据元模型、工程模名称生成工程模对象
|
MapProperty addNewProject(const QString& sMeta,const QString& sProject,PropertyModel&); //根据元模型、工程模名称生成工程模对象
|
||||||
void update();
|
//void update();
|
||||||
void generate(const QString&); //根据输入名称生成表
|
void generate(const QString&); //根据输入名称生成表
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
@ -53,13 +71,17 @@ public slots:
|
||||||
void onCancelClicked();
|
void onCancelClicked();
|
||||||
void onApplyClicked();
|
void onApplyClicked();
|
||||||
void onRevokeClicked();
|
void onRevokeClicked();
|
||||||
void onBaseModelIndexChanged(const QString&);
|
//void onBaseModelIndexChanged(const QString&);
|
||||||
void onProjectIndexChanged(const QString&);
|
//void onProjectIndexChanged(const QString&);
|
||||||
void onPropertyIndexChanged(const QString&);
|
//void onPropertyIndexChanged(const QString&);
|
||||||
void onIconClicked(const QModelIndex &index); //关联图元改变
|
//void onIconClicked(const QModelIndex &index); //关联图元改变
|
||||||
void onIndexClicked(const QModelIndex &index); //索引列表点击
|
//void onIndexClicked(const QModelIndex &index); //索引列表点击
|
||||||
void onIndexRbtnClicked(const QPoint &pos); //索引列表右键菜单
|
void onIndexRbtnClicked(const QPoint &pos); //索引列表右键菜单
|
||||||
void onDeleteProjectClicked(); //删除选中工程模
|
void onDeleteProjectClicked(); //删除选中工程模
|
||||||
|
|
||||||
|
void addPropertyGroup(); //添加tableWidget中的工程模
|
||||||
|
void onTableItemClicked(QTableWidgetItem *item); //模型item点击事件
|
||||||
|
void onDelegateFinishEdit(const QModelIndex &index, const QString &value); //lineEdit代理编辑完成事件
|
||||||
public:
|
public:
|
||||||
QStringList getModelList() const; //获取元模型列表
|
QStringList getModelList() const; //获取元模型列表
|
||||||
QStringList getGroupList(const QString& model) const; //返回该元模下的属性组列表
|
QStringList getGroupList(const QString& model) const; //返回该元模下的属性组列表
|
||||||
|
|
@ -70,20 +92,33 @@ public:
|
||||||
QString getMetaName() const; //返回当前元模型名
|
QString getMetaName() const; //返回当前元模型名
|
||||||
bool ifProjectEqual(QMap<QString,QJsonObject>); //根据每个属性组的勾选状态判断两个模型是否相同
|
bool ifProjectEqual(QMap<QString,QJsonObject>); //根据每个属性组的勾选状态判断两个模型是否相同
|
||||||
QString modifyProjectModel(QMap<QString,QJsonObject>); //修改工程模
|
QString modifyProjectModel(QMap<QString,QJsonObject>); //修改工程模
|
||||||
|
bool renameProjectModel(const QString& strCur,QMap<QString,projectManager> datas); //重命名工程模
|
||||||
|
void updateComponentModelName(const QString& strOld,const QString& strNew); //更新component中的工程模
|
||||||
private:
|
private:
|
||||||
void updateIconList(); //选择工程模后刷新关联图标
|
//void updateIconList(); //选择工程模后刷新关联图标
|
||||||
void removeProjectData(const QString&,const QString&); //移除对应的project层级结构
|
void removeProjectData(const QString&,const QString&,int role); //移除对应的project层级结构
|
||||||
QString getItemDataType(const QStandardItem* pItem); //返回数据类型
|
QString getItemDataType(const QStandardItem* pItem); //返回数据类型
|
||||||
bool createPropertyTable(const QString& sProject,MapProperty::Iterator iter,int nLinkType); //创建属性组表并插入记录到管理表(工程名,当前项迭代器,关联图元类型)
|
bool createPropertyTable(const QString& sProject,const QString& sGroup,QList<QStandardItem*> lstSelect,QList<QStandardItem*> lstBase,int nLinkType); //创建属性组表并插入记录到管理表(工程名,当前项迭代器,关联图元类型)
|
||||||
QJsonObject getSelectedState(MapProperty::Iterator iter); //返回json格式的选中状态
|
QJsonObject getSelectedState(QList<QStandardItem*> select,QList<QStandardItem*> base); //返回json格式的选中状态
|
||||||
|
QList<QStandardItem*> getGroupSub(QStandardItemModel*,const QString&); //返回指定组下的属性(如果存在)
|
||||||
|
|
||||||
|
void setupUI();
|
||||||
|
void initialTypeMap();
|
||||||
|
int getLevel(QStandardItem *item); //返回当前item所在层级,0为根
|
||||||
|
projectState couldSave();
|
||||||
|
|
||||||
|
void setTableItemState(int row,TableItemState state); //设置状态
|
||||||
|
int getModelEditState(); //返回工程模编辑状态(选择、编辑、新建)
|
||||||
private:
|
private:
|
||||||
Ui::projectModelDlg *ui;
|
Ui::projectModelDlg *ui;
|
||||||
RenameModel* m_pRenameModel;
|
|
||||||
QStandardItemModel* _viewModel; //索引view模型
|
|
||||||
MapMeta m_mapTotal;
|
MapMeta m_mapTotal;
|
||||||
QString _curMeta; //当前元模型
|
QString _curMeta; //当前元模型
|
||||||
QString _curProject; //当前工程模
|
QString _curProject; //当前工程模
|
||||||
QString _curProperty; //当前属性
|
QString _curType; //当前关联类型
|
||||||
|
PropertyModel _curModel; //新建的model
|
||||||
|
int _curRow; //当前操作行
|
||||||
|
|
||||||
|
BiDirectionalMap<QString,int> _mapType; //类型名映射表
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
#ifndef PROJECTMODELCOMBODELEGATE_H
|
||||||
|
#define PROJECTMODELCOMBODELEGATE_H
|
||||||
|
|
||||||
|
#include <QStyledItemDelegate>
|
||||||
|
|
||||||
|
class ProjectTableDelegate : public QStyledItemDelegate
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
ProjectTableDelegate(QObject *parent = nullptr);
|
||||||
|
~ProjectTableDelegate();
|
||||||
|
|
||||||
|
QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option,const QModelIndex& index) const override;
|
||||||
|
|
||||||
|
//bool eventFilter(QObject* obj, QEvent* event) override;
|
||||||
|
|
||||||
|
//void setEditorData(QWidget* editor, const QModelIndex& index) const override;
|
||||||
|
|
||||||
|
//void setModelData(QWidget* editor, QAbstractItemModel* model,const QModelIndex& index) const override;
|
||||||
|
|
||||||
|
bool editorEvent(QEvent* event, QAbstractItemModel* model,
|
||||||
|
const QStyleOptionViewItem& option, const QModelIndex& index) override;
|
||||||
|
void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
|
||||||
|
signals:
|
||||||
|
void editingFinished(const QModelIndex &index, const QString &value) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // PROJECTMODELCOMBODELEGATE_H
|
||||||
|
|
@ -8,13 +8,13 @@ QT_BEGIN_NAMESPACE
|
||||||
namespace Ui { class renameModel; }
|
namespace Ui { class renameModel; }
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
enum projectState
|
/*enum projectState
|
||||||
{
|
{
|
||||||
Err = -1,
|
Err = -1,
|
||||||
NotExist = 0,
|
NotExist = 0,
|
||||||
Exist,
|
Exist,
|
||||||
Changed
|
Changed
|
||||||
};
|
};*/
|
||||||
|
|
||||||
class projectModelDlg;
|
class projectModelDlg;
|
||||||
|
|
||||||
|
|
@ -35,7 +35,7 @@ public slots:
|
||||||
void onCancelClicked();
|
void onCancelClicked();
|
||||||
private:
|
private:
|
||||||
void setShowName(); //获取当前名称并显示
|
void setShowName(); //获取当前名称并显示
|
||||||
projectState couldSave(); //判断当前名称是否可用
|
//projectState couldSave(); //判断当前名称是否可用
|
||||||
private:
|
private:
|
||||||
Ui::renameModel *ui;
|
Ui::renameModel *ui;
|
||||||
projectModelDlg* _pParent;
|
projectModelDlg* _pParent;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
#ifndef SELECTORDIALOG_H
|
||||||
|
#define SELECTORDIALOG_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QStandardItemModel>
|
||||||
|
#include <QListView>
|
||||||
|
#include <QDialogButtonBox>
|
||||||
|
#include "global.h"
|
||||||
|
|
||||||
|
// 自定义元件选择对话框
|
||||||
|
class SelectorDialog : public QDialog {
|
||||||
|
public:
|
||||||
|
SelectorDialog(QWidget* parent = nullptr);
|
||||||
|
|
||||||
|
void initial(SelectorDialogType tpe);
|
||||||
|
QString selectedComponent() const {
|
||||||
|
return m_selectedComponent;
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
QListView* m_listView;
|
||||||
|
QString m_selectedComponent;
|
||||||
|
QDialogButtonBox* m_buttonBox;
|
||||||
|
SelectorDialogType m_dlgType;
|
||||||
|
|
||||||
|
void setupUI();
|
||||||
|
void setupConnections();
|
||||||
|
QStandardItemModel * initialModel();
|
||||||
|
private:
|
||||||
|
QStringList getMetaList() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //SELECTORDIALOG_H
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,153 @@
|
||||||
|
#include <QLineEdit>
|
||||||
|
#include <QComboBox>
|
||||||
|
#include <QEvent>
|
||||||
|
|
||||||
|
#include "projectTableDelegate.h"
|
||||||
|
#include "selectorDialog.h"
|
||||||
|
#include "global.h"
|
||||||
|
|
||||||
|
ProjectTableDelegate::ProjectTableDelegate(QObject *parent)
|
||||||
|
: QStyledItemDelegate(parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
ProjectTableDelegate::~ProjectTableDelegate()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
QWidget* ProjectTableDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option,
|
||||||
|
const QModelIndex& index) const
|
||||||
|
{
|
||||||
|
if(index.column() == TD_ProjectModel) //editline
|
||||||
|
{
|
||||||
|
QLineEdit *editor = new QLineEdit(parent);
|
||||||
|
|
||||||
|
// 连接编辑完成信号
|
||||||
|
connect(editor, &QLineEdit::editingFinished, this, [this, editor, index]() {
|
||||||
|
emit editingFinished(index, editor->text());
|
||||||
|
});
|
||||||
|
|
||||||
|
return editor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*bool ProjectTableDelegate::eventFilter(QObject* obj, QEvent* event)
|
||||||
|
{
|
||||||
|
if (event->type() == QEvent::KeyPress) {
|
||||||
|
QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
|
||||||
|
if (keyEvent->key() == Qt::Key_Return || keyEvent->key() == Qt::Key_Enter) {
|
||||||
|
QLineEdit* editor = qobject_cast<QLineEdit*>(obj);
|
||||||
|
if (editor) {
|
||||||
|
emit yourCustomSignal(editor->text());
|
||||||
|
commitData(editor); // 显式提交数据
|
||||||
|
closeEditor(editor); // 关闭编辑器
|
||||||
|
return true; // 阻止事件继续传播
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return QStyledItemDelegate::eventFilter(obj, event);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
/*void ProjectTableDelegate::setEditorData(QWidget* editor, const QModelIndex& index) const
|
||||||
|
{
|
||||||
|
if(index.column() == TD_MetaModel)
|
||||||
|
{
|
||||||
|
QComboBox* comboBox = static_cast<QComboBox*>(editor);
|
||||||
|
comboBox->setCurrentText(index.data(Qt::EditRole).toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectTableDelegate::setModelData(QWidget* editor, QAbstractItemModel* model,
|
||||||
|
const QModelIndex& index) const
|
||||||
|
{
|
||||||
|
if(index.column() == TD_MetaModel)
|
||||||
|
{
|
||||||
|
QComboBox* comboBox = static_cast<QComboBox*>(editor);
|
||||||
|
model->setData(index, comboBox->currentText(), Qt::EditRole);
|
||||||
|
|
||||||
|
emit editingFinished(index, comboBox->currentText()); //发送自定义信号
|
||||||
|
}
|
||||||
|
|
||||||
|
}*/
|
||||||
|
|
||||||
|
bool ProjectTableDelegate::editorEvent(QEvent* event, QAbstractItemModel* model,
|
||||||
|
const QStyleOptionViewItem& option, const QModelIndex& index)
|
||||||
|
{
|
||||||
|
if (event->type() == QEvent::MouseButtonDblClick) {
|
||||||
|
if(index.column() == TD_ProjectModel)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else if(index.column() == TD_MetaModel)
|
||||||
|
{
|
||||||
|
SelectorDialog dialog(option.widget->parentWidget()->parentWidget()->parentWidget()->parentWidget());
|
||||||
|
dialog.initial(ST_MetaModel);
|
||||||
|
if(dialog.exec() == QDialog::Accepted) {
|
||||||
|
QString component = dialog.selectedComponent();
|
||||||
|
if(!component.isEmpty()) {
|
||||||
|
model->setData(index, component, Qt::EditRole);
|
||||||
|
emit editingFinished(index,component);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(index.column() == TD_ComponentType)
|
||||||
|
{
|
||||||
|
SelectorDialog dialog(option.widget->parentWidget()->parentWidget()->parentWidget()->parentWidget());
|
||||||
|
dialog.initial(ST_ComponentType);
|
||||||
|
if(dialog.exec() == QDialog::Accepted) {
|
||||||
|
QString component = dialog.selectedComponent();
|
||||||
|
if(!component.isEmpty()) {
|
||||||
|
model->setData(index, component, Qt::EditRole);
|
||||||
|
emit editingFinished(index,component);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return QStyledItemDelegate::editorEvent(event, model, option, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectTableDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
|
||||||
|
{
|
||||||
|
//根据行号设置交替色
|
||||||
|
QStyleOptionViewItem opt = option;
|
||||||
|
initStyleOption(&opt, index);
|
||||||
|
|
||||||
|
QModelIndex firstColIndex = index.sibling(index.row(), 0);
|
||||||
|
TableItemState state = TableItemState(firstColIndex.data(Qt::UserRole).toInt());
|
||||||
|
|
||||||
|
/*if(index.column() == 0 && state == TS_create)
|
||||||
|
{
|
||||||
|
opt.palette.setColor(QPalette::Text, Qt::red);
|
||||||
|
}
|
||||||
|
else if(index.column() == 0 && state == TS_select)
|
||||||
|
{
|
||||||
|
opt.palette.setColor(QPalette::Text, Qt::green);
|
||||||
|
}
|
||||||
|
else if(index.column() == 0 && state == TS_edit)
|
||||||
|
{
|
||||||
|
opt.palette.setColor(QPalette::Text, Qt::yellow);
|
||||||
|
}
|
||||||
|
QStyledItemDelegate::paint(painter, opt, index);*/
|
||||||
|
|
||||||
|
|
||||||
|
if(state == TS_create)
|
||||||
|
{
|
||||||
|
opt.palette.setColor(QPalette::Text, Qt::red);
|
||||||
|
}
|
||||||
|
else if(state == TS_select)
|
||||||
|
{
|
||||||
|
opt.palette.setColor(QPalette::Text, Qt::green);
|
||||||
|
}
|
||||||
|
else if(state == TS_edit)
|
||||||
|
{
|
||||||
|
opt.palette.setColor(QPalette::Text, Qt::yellow);
|
||||||
|
}
|
||||||
|
|
||||||
|
//先执行默认绘制(包括背景、文本等基础元素)
|
||||||
|
QStyledItemDelegate::paint(painter, opt, index);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -63,7 +63,7 @@ void RenameModel::setShowName()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
projectState RenameModel::couldSave()
|
/*projectState RenameModel::couldSave()
|
||||||
{
|
{
|
||||||
if(_pParent)
|
if(_pParent)
|
||||||
{
|
{
|
||||||
|
|
@ -93,11 +93,11 @@ projectState RenameModel::couldSave()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
void RenameModel::onOkClicked()
|
void RenameModel::onOkClicked()
|
||||||
{
|
{
|
||||||
if(_pParent)
|
/*if(_pParent)
|
||||||
{
|
{
|
||||||
projectState state = couldSave();
|
projectState state = couldSave();
|
||||||
switch(state){
|
switch(state){
|
||||||
|
|
@ -140,7 +140,7 @@ void RenameModel::onOkClicked()
|
||||||
ui->label_info->clear();
|
ui->label_info->clear();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenameModel::onCancelClicked()
|
void RenameModel::onCancelClicked()
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,94 @@
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include "selectorDialog.h"
|
||||||
|
#include "global.h"
|
||||||
|
#include "dataBase.h"
|
||||||
|
|
||||||
|
SelectorDialog::SelectorDialog(QWidget* parent)
|
||||||
|
: QDialog(parent)
|
||||||
|
,m_buttonBox(nullptr)
|
||||||
|
{
|
||||||
|
this->setWindowFlags(Qt::FramelessWindowHint | windowFlags());
|
||||||
|
}
|
||||||
|
|
||||||
|
void SelectorDialog::initial(SelectorDialogType tpe)
|
||||||
|
{
|
||||||
|
m_dlgType = tpe;
|
||||||
|
setupUI();
|
||||||
|
setupConnections();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SelectorDialog::setupUI() {
|
||||||
|
setWindowTitle("选择类型");
|
||||||
|
setFixedSize(200, 200);
|
||||||
|
|
||||||
|
m_listView = new QListView(this);
|
||||||
|
QStandardItemModel* model = initialModel();
|
||||||
|
m_listView->setModel(model);
|
||||||
|
m_listView->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||||
|
|
||||||
|
m_buttonBox = new QDialogButtonBox(
|
||||||
|
QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||||
|
|
||||||
|
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||||
|
layout->addWidget(m_listView);
|
||||||
|
layout->addWidget(m_buttonBox);
|
||||||
|
}
|
||||||
|
|
||||||
|
QStandardItemModel * SelectorDialog::initialModel()
|
||||||
|
{
|
||||||
|
QStandardItemModel *model = new QStandardItemModel(this);
|
||||||
|
if(m_dlgType == ST_MetaModel){
|
||||||
|
QStringList metas = getMetaList();
|
||||||
|
for(auto &meta:metas)
|
||||||
|
{
|
||||||
|
QStandardItem *item = new QStandardItem();
|
||||||
|
//item->setIcon(QIcon(":/icons/folder.png")); // 设置图标
|
||||||
|
item->setText(meta); // 设置文本
|
||||||
|
model->appendRow(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(m_dlgType == ST_ComponentType){
|
||||||
|
QStringList components = {"断路器", "母线", "异步电动机"};
|
||||||
|
for(auto &obj:components)
|
||||||
|
{
|
||||||
|
QStandardItem *item = new QStandardItem();
|
||||||
|
//item->setIcon(QIcon(":/icons/folder.png")); // 设置图标
|
||||||
|
item->setText(obj); // 设置文本
|
||||||
|
//item->setData("Extra Data for Item 1", Qt::UserRole); // 设置额外属性
|
||||||
|
|
||||||
|
model->appendRow(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SelectorDialog::setupConnections() {
|
||||||
|
connect(m_listView, &QListView::doubleClicked, [this](const QModelIndex& index){
|
||||||
|
m_selectedComponent = index.data().toString();
|
||||||
|
accept();
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(m_buttonBox, &QDialogButtonBox::accepted, [this]{
|
||||||
|
if(auto index = m_listView->currentIndex(); index.isValid()) {
|
||||||
|
m_selectedComponent = index.data().toString();
|
||||||
|
}
|
||||||
|
accept();
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(m_buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList SelectorDialog::getMetaList() const
|
||||||
|
{
|
||||||
|
QMap<int,modelType> modelMap = DataBase::GetInstance()->ModelType();
|
||||||
|
|
||||||
|
QSet<QString> modelSet;
|
||||||
|
for(auto &model:modelMap)
|
||||||
|
{
|
||||||
|
modelSet.insert(model.modelType);
|
||||||
|
}
|
||||||
|
|
||||||
|
return QStringList(modelSet.values());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -57,9 +57,12 @@
|
||||||
<enum>Qt::Orientation::Vertical</enum>
|
<enum>Qt::Orientation::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="widget_2" native="true">
|
<widget class="QWidget" name="widget_2" native="true">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">color: rgb(15, 15, 15);</string>
|
||||||
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>4</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
|
|
@ -86,91 +89,60 @@ color: rgb(8, 8, 8);</string>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTreeView" name="treeView_model">
|
<widget class="QTableWidget" name="tableWidget_model">
|
||||||
<property name="font">
|
<property name="styleSheet">
|
||||||
<font>
|
<string notr="true">QTableView
|
||||||
<pointsize>12</pointsize>
|
{
|
||||||
</font>
|
outline:0px;
|
||||||
|
}
|
||||||
|
QTableView::item
|
||||||
|
{
|
||||||
|
border:0px;
|
||||||
|
background-color:transparent;
|
||||||
|
}
|
||||||
|
QTableView::item:hover
|
||||||
|
{
|
||||||
|
background-color:transparent;
|
||||||
|
}
|
||||||
|
QTableView::item:selected
|
||||||
|
{
|
||||||
|
color:rgb(0,0,0);
|
||||||
|
background-color:rgb(211, 241, 250);
|
||||||
|
}</string>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="headerVisible">
|
|
||||||
<bool>false</bool>
|
|
||||||
</attribute>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btn_new">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>12</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>新建</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QStackedWidget" name="stackedWidget">
|
|
||||||
<property name="currentIndex">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="page">
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QWidget" name="widget_3" native="true">
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_7">
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">background-color: rgb(165, 165, 165);
|
|
||||||
font: 12pt "Microsoft YaHei UI";
|
|
||||||
color: rgb(8, 8, 8);</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>工程模类型</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QListView" name="listView_icon"/>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_linkState">
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">font: 12pt "Microsoft YaHei UI";
|
|
||||||
color: rgb(8, 8, 8);</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>关联状态:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="page_2"/>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
@ -188,22 +160,8 @@ QWidget{
|
||||||
}</string>
|
}</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="2" column="2" rowspan="4">
|
<item row="1" column="1">
|
||||||
<widget class="QTreeView" name="treeView_sub">
|
<spacer name="verticalSpacer">
|
||||||
<attribute name="headerVisible">
|
|
||||||
<bool>false</bool>
|
|
||||||
</attribute>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="1">
|
|
||||||
<widget class="QPushButton" name="btn_apply">
|
|
||||||
<property name="text">
|
|
||||||
<string>>></string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="1">
|
|
||||||
<spacer name="verticalSpacer_2">
|
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Orientation::Vertical</enum>
|
<enum>Qt::Orientation::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
|
|
@ -215,7 +173,14 @@ QWidget{
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0" colspan="3">
|
<item row="2" column="1">
|
||||||
|
<widget class="QPushButton" name="btn_apply">
|
||||||
|
<property name="text">
|
||||||
|
<string>>></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0" colspan="3">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
|
|
@ -253,7 +218,7 @@ QWidget{
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="btn_cancel">
|
<widget class="QPushButton" name="btn_cancel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>取消</string>
|
<string>关闭</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
@ -272,131 +237,14 @@ QWidget{
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="1" column="0" rowspan="4">
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Orientation::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>156</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0" rowspan="4">
|
|
||||||
<widget class="QTreeView" name="treeView_base">
|
<widget class="QTreeView" name="treeView_base">
|
||||||
<attribute name="headerVisible">
|
<attribute name="headerVisible">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</attribute>
|
</attribute>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="1">
|
<item row="0" column="0">
|
||||||
<widget class="QPushButton" name="btn_revoke">
|
|
||||||
<property name="text">
|
|
||||||
<string><<</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0" colspan="3">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer_5">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Orientation::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>Microsoft YaHei UI</family>
|
|
||||||
<pointsize>12</pointsize>
|
|
||||||
<italic>false</italic>
|
|
||||||
<bold>false</bold>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true"/>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>元模:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="cb_baseModel"/>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_3">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>Microsoft YaHei UI</family>
|
|
||||||
<pointsize>12</pointsize>
|
|
||||||
<italic>false</italic>
|
|
||||||
<bold>false</bold>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true"/>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>工程模:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="cb_projectModel">
|
|
||||||
<property name="editable">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>Microsoft YaHei UI</family>
|
|
||||||
<pointsize>12</pointsize>
|
|
||||||
<italic>false</italic>
|
|
||||||
<bold>false</bold>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true"/>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>属性类别:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="cb_property"/>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer_6">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Orientation::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="label_5">
|
<widget class="QLabel" name="label_5">
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true">background-color: rgb(165, 165, 165);
|
<string notr="true">background-color: rgb(165, 165, 165);
|
||||||
|
|
@ -408,7 +256,21 @@ color: rgb(8, 8, 8);</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2">
|
<item row="3" column="1">
|
||||||
|
<widget class="QPushButton" name="btn_revoke">
|
||||||
|
<property name="text">
|
||||||
|
<string><<</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2" rowspan="4">
|
||||||
|
<widget class="QTreeView" name="treeView_sub">
|
||||||
|
<attribute name="headerVisible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
<widget class="QLabel" name="label_6">
|
<widget class="QLabel" name="label_6">
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true">background-color: rgb(165, 165, 165);
|
<string notr="true">background-color: rgb(165, 165, 165);
|
||||||
|
|
@ -420,6 +282,19 @@ color: rgb(8, 8, 8);</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<spacer name="verticalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>156</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue