add diagramEditor bus setting/fixed bug
This commit is contained in:
parent
93892cc597
commit
9e42cbb222
|
|
@ -384,15 +384,20 @@ struct gridInfo //grid
|
||||||
//===================组态编辑器使用================
|
//===================组态编辑器使用================
|
||||||
struct DiagramEditorWizardInfo //组态编辑向导信息
|
struct DiagramEditorWizardInfo //组态编辑向导信息
|
||||||
{
|
{
|
||||||
int bus_220_num = 0;
|
int nIndex = 0;
|
||||||
int bus_220_division = 1;
|
double dVoltage = 0;
|
||||||
int bus_220_circuit = 0;
|
int nLineType = 1; //1单母线,2双母线
|
||||||
int bus_110_num = 0;
|
QMap<bool,int> mapDivide; //母线划分数,false为1母线,true为2母
|
||||||
int bus_110_division = 1;
|
int connectType = 0; //接线方式,1为分段连接
|
||||||
int bus_110_circuit = 0;
|
};
|
||||||
int bus_35_num = 0;
|
|
||||||
int bus_35_division = 1;
|
struct DiagramEditorBusInfo //组态编辑母线信息
|
||||||
int bus_35_circuit = 0;
|
{
|
||||||
|
int nIndex = 0;
|
||||||
|
double dVoltage = 0;
|
||||||
|
int nLineType = 1; //1单母线,2双母线
|
||||||
|
QMap<bool,int> mapDivide; //母线划分数,false为1母线,true为2母
|
||||||
|
int connectType = 0; //接线方式,1为分段连接
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class DiagramEditorStructType
|
enum class DiagramEditorStructType
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ set(DIAGRAMCAVAS_HEADER_FILES
|
||||||
include/diagramEditor/editBus.h
|
include/diagramEditor/editBus.h
|
||||||
include/diagramEditor/editBaseStruct.h
|
include/diagramEditor/editBaseStruct.h
|
||||||
include/diagramEditor/diagramEditorWizard.h
|
include/diagramEditor/diagramEditorWizard.h
|
||||||
|
include/diagramEditor/wizardBusTableDelegate.h
|
||||||
include/graphicsDataModel/baseModel.h
|
include/graphicsDataModel/baseModel.h
|
||||||
include/graphicsDataModel/fixedPortsModel.h
|
include/graphicsDataModel/fixedPortsModel.h
|
||||||
include/graphicsItem/electricConnectLineItem.h
|
include/graphicsItem/electricConnectLineItem.h
|
||||||
|
|
@ -103,6 +104,7 @@ set(DIAGRAMCAVAS_SOURCE_FILES
|
||||||
source/diagramEditor/editBus.cpp
|
source/diagramEditor/editBus.cpp
|
||||||
source/diagramEditor/editBaseStruct.cpp
|
source/diagramEditor/editBaseStruct.cpp
|
||||||
source/diagramEditor/diagramEditorWizard.cpp
|
source/diagramEditor/diagramEditorWizard.cpp
|
||||||
|
source/diagramEditor/wizardBusTableDelegate.cpp
|
||||||
source/graphicsDataModel/baseModel.cpp
|
source/graphicsDataModel/baseModel.cpp
|
||||||
source/graphicsDataModel/fixedPortsModel.cpp
|
source/graphicsDataModel/fixedPortsModel.cpp
|
||||||
source/graphicsItem/electricConnectLineItem.cpp
|
source/graphicsItem/electricConnectLineItem.cpp
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,26 @@ signals:
|
||||||
protected:
|
protected:
|
||||||
void onOkClicked();
|
void onOkClicked();
|
||||||
void onCancelClicked();
|
void onCancelClicked();
|
||||||
|
void onLastClicked();
|
||||||
|
void onNextClicked();
|
||||||
|
|
||||||
|
void onAddBusClicked(); //添加母线
|
||||||
|
void onAddBayClicked(); //添加间隔
|
||||||
|
void onAddTransClicked(); //添加变压器
|
||||||
|
|
||||||
|
void onDelegateFinishEdit(const QModelIndex &index, const QString &value); //代理edit完成事件
|
||||||
|
void onBusDeleteClicked();
|
||||||
|
void onBusIndexRbtnClicked(const QPoint &pos); //bus列表右键菜单
|
||||||
|
private:
|
||||||
|
void initial();
|
||||||
|
void reOrderBus(); //重置bus次序
|
||||||
|
|
||||||
|
void generateBayPage(); //根据bus设置生成bay页
|
||||||
|
template <typename T> void reindexQMap(QMap<int, T> &map); //重新排序函数
|
||||||
private:
|
private:
|
||||||
Ui::diagramEditorWizard *ui;
|
Ui::diagramEditorWizard *ui;
|
||||||
|
QMap<int,DiagramEditorBusInfo> _mapBus; //母线信息
|
||||||
|
bool _busPageChanged; //母线页改变
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
#ifndef WIZARDBUSTABLEDELEGATE_H
|
||||||
|
#define WIZARDBUSTABLEDELEGATE_H
|
||||||
|
|
||||||
|
#include <QStyledItemDelegate>
|
||||||
|
|
||||||
|
class WizardBusTableDelegate : public QStyledItemDelegate
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
WizardBusTableDelegate(QObject *parent = nullptr);
|
||||||
|
~WizardBusTableDelegate();
|
||||||
|
|
||||||
|
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 // WIZARDBUSTABLEDELEGATE_H
|
||||||
|
|
@ -1,4 +1,7 @@
|
||||||
|
#include <QMenu>
|
||||||
|
#include <QMessageBox>
|
||||||
#include "diagramEditor/diagramEditorWizard.h"
|
#include "diagramEditor/diagramEditorWizard.h"
|
||||||
|
#include "diagramEditor/wizardBusTableDelegate.h"
|
||||||
#include "ui_diagramEditorWizard.h"
|
#include "ui_diagramEditorWizard.h"
|
||||||
|
|
||||||
DiagramEditorWizard::DiagramEditorWizard(QWidget *parent)
|
DiagramEditorWizard::DiagramEditorWizard(QWidget *parent)
|
||||||
|
|
@ -6,11 +9,9 @@ DiagramEditorWizard::DiagramEditorWizard(QWidget *parent)
|
||||||
, ui(new Ui::diagramEditorWizard)
|
, ui(new Ui::diagramEditorWizard)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
_busPageChanged = false;
|
||||||
this->setWindowFlags(Qt::FramelessWindowHint | windowFlags());
|
this->setWindowFlags(Qt::FramelessWindowHint | windowFlags());
|
||||||
ui->stackedWidget_btn->setCurrentIndex(1);
|
initial();
|
||||||
ui->btn_last->setVisible(false);
|
|
||||||
connect(ui->btn_ok,&QPushButton::clicked,this,&DiagramEditorWizard::onOkClicked);
|
|
||||||
connect(ui->btn_cancel,&QPushButton::clicked,this,&DiagramEditorWizard::onCancelClicked);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DiagramEditorWizard::~DiagramEditorWizard()
|
DiagramEditorWizard::~DiagramEditorWizard()
|
||||||
|
|
@ -18,20 +19,67 @@ DiagramEditorWizard::~DiagramEditorWizard()
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DiagramEditorWizard::initial()
|
||||||
|
{
|
||||||
|
ui->tabWidget->tabBar()->setEnabled(false);
|
||||||
|
connect(ui->btn_ok,&QPushButton::clicked,this,&DiagramEditorWizard::onOkClicked);
|
||||||
|
connect(ui->btn_cancel,&QPushButton::clicked,this,&DiagramEditorWizard::onCancelClicked);
|
||||||
|
connect(ui->btn_last,&QPushButton::clicked,this,&DiagramEditorWizard::onLastClicked);
|
||||||
|
connect(ui->btn_next,&QPushButton::clicked,this,&DiagramEditorWizard::onNextClicked);
|
||||||
|
connect(ui->btn_addBus,&QPushButton::clicked,this,&DiagramEditorWizard::onAddBusClicked);
|
||||||
|
connect(ui->btn_addBay,&QPushButton::clicked,this,&DiagramEditorWizard::onAddBayClicked);
|
||||||
|
connect(ui->btn_addTrans,&QPushButton::clicked,this,&DiagramEditorWizard::onAddTransClicked);
|
||||||
|
|
||||||
|
QStringList headerText;
|
||||||
|
headerText<<"层级"<<"电压等级"<<"主接线"<<"分段方式"<<"接线方式";
|
||||||
|
ui->tableWidget_bus->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
|
ui->tableWidget_bus->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||||
|
ui->tableWidget_bus->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||||
|
ui->tableWidget_bus->setColumnCount(headerText.count());
|
||||||
|
ui->tableWidget_bus->setHorizontalHeaderLabels(headerText);
|
||||||
|
ui->tableWidget_bus->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
||||||
|
|
||||||
|
WizardBusTableDelegate* delegate = new WizardBusTableDelegate(this);
|
||||||
|
ui->tableWidget_bus->setItemDelegate(delegate);
|
||||||
|
|
||||||
|
connect(delegate,&WizardBusTableDelegate::editingFinished,this,&DiagramEditorWizard::onDelegateFinishEdit);
|
||||||
|
connect(ui->tableWidget_bus, &QTableWidget::customContextMenuRequested, this, &DiagramEditorWizard::onBusIndexRbtnClicked);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DiagramEditorWizard::reOrderBus()
|
||||||
|
{
|
||||||
|
reindexQMap(_mapBus);
|
||||||
|
|
||||||
|
for(int row = 0 ;row < ui->tableWidget_bus->rowCount();++row)
|
||||||
|
{
|
||||||
|
QTableWidgetItem* pItem = ui->tableWidget_bus->item(row,0);
|
||||||
|
pItem->setText("第"+QString::number(row)+"层");
|
||||||
|
pItem->setData(Qt::UserRole,row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T> void DiagramEditorWizard::reindexQMap(QMap<int, T> &map) {
|
||||||
|
if (map.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
// 保存原数据的值(按原键升序排列)
|
||||||
|
QVector<T> values;
|
||||||
|
values.reserve(map.size());
|
||||||
|
for (auto it = map.begin(); it != map.end(); ++it) {
|
||||||
|
values.append(std::move(it.value())); // 使用移动语义
|
||||||
|
}
|
||||||
|
|
||||||
|
// 清空原map并重新插入连续键
|
||||||
|
map.clear();
|
||||||
|
for (int newKey = 0; newKey < values.size(); ++newKey) {
|
||||||
|
map.insert(newKey, std::move(values[newKey])); // 再次移动
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DiagramEditorWizard::onOkClicked()
|
void DiagramEditorWizard::onOkClicked()
|
||||||
{
|
{
|
||||||
DiagramEditorWizardInfo info;
|
DiagramEditorWizardInfo info;
|
||||||
info.bus_220_num = ui->cb_num_220->currentIndex();
|
|
||||||
info.bus_220_division = ui->cb_div_220->currentText().toInt();
|
|
||||||
info.bus_220_circuit = ui->sp_circuit_220->value();
|
|
||||||
|
|
||||||
info.bus_110_num = ui->cb_num_110->currentIndex();
|
|
||||||
info.bus_110_division = ui->cb_div_110->currentText().toInt();
|
|
||||||
info.bus_110_circuit = ui->sp_circuit_110->value();
|
|
||||||
|
|
||||||
info.bus_35_num = ui->cb_num_35->currentIndex();
|
|
||||||
info.bus_35_division = ui->cb_div_35->currentText().toInt();
|
|
||||||
info.bus_35_circuit = ui->sp_circuit_35->value();
|
|
||||||
emit wizardFinish(info);
|
emit wizardFinish(info);
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
|
|
@ -40,3 +88,174 @@ void DiagramEditorWizard::onCancelClicked()
|
||||||
{
|
{
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DiagramEditorWizard::onLastClicked()
|
||||||
|
{
|
||||||
|
if(ui->tabWidget->currentIndex() == 2){
|
||||||
|
ui->tabWidget->setCurrentIndex(1);
|
||||||
|
ui->stackedWidget_last->setCurrentIndex(1);
|
||||||
|
ui->stackedWidget_next->setCurrentIndex(0);
|
||||||
|
}
|
||||||
|
else if(ui->tabWidget->currentIndex() == 1){
|
||||||
|
ui->tabWidget->setCurrentIndex(0);
|
||||||
|
ui->stackedWidget_last->setCurrentIndex(0);
|
||||||
|
ui->stackedWidget_next->setCurrentIndex(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DiagramEditorWizard::onNextClicked()
|
||||||
|
{
|
||||||
|
if(ui->tabWidget->currentIndex() == 0){
|
||||||
|
ui->tabWidget->setCurrentIndex(1);
|
||||||
|
ui->stackedWidget_last->setCurrentIndex(1);
|
||||||
|
ui->stackedWidget_next->setCurrentIndex(0);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
else if(ui->tabWidget->currentIndex() == 1){
|
||||||
|
ui->tabWidget->setCurrentIndex(2);
|
||||||
|
ui->stackedWidget_last->setCurrentIndex(1);
|
||||||
|
ui->stackedWidget_next->setCurrentIndex(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DiagramEditorWizard::onAddBusClicked()
|
||||||
|
{
|
||||||
|
int row = ui->tableWidget_bus->rowCount();
|
||||||
|
ui->tableWidget_bus->insertRow(row);
|
||||||
|
|
||||||
|
// 层级
|
||||||
|
QTableWidgetItem* levelItem = new QTableWidgetItem("第"+QString::number(row)+"层");
|
||||||
|
ui->tableWidget_bus->setItem(row, 0, levelItem);
|
||||||
|
levelItem->setData(Qt::UserRole,row);
|
||||||
|
|
||||||
|
// 电压等级
|
||||||
|
QTableWidgetItem* voltageItem = new QTableWidgetItem("未设置");
|
||||||
|
ui->tableWidget_bus->setItem(row, 1, voltageItem);
|
||||||
|
|
||||||
|
// 主接线
|
||||||
|
QTableWidgetItem* typeItem = new QTableWidgetItem("未设置");
|
||||||
|
ui->tableWidget_bus->setItem(row, 2, typeItem);
|
||||||
|
|
||||||
|
// 分段方式
|
||||||
|
QTableWidgetItem* divideItem = new QTableWidgetItem("未设置");
|
||||||
|
ui->tableWidget_bus->setItem(row, 3, divideItem);
|
||||||
|
|
||||||
|
// 接线方式
|
||||||
|
QTableWidgetItem* connectItem = new QTableWidgetItem("未选择");
|
||||||
|
ui->tableWidget_bus->setItem(row, 4, connectItem);
|
||||||
|
|
||||||
|
DiagramEditorBusInfo info;
|
||||||
|
info.nIndex = row;
|
||||||
|
_mapBus.insert(row,info);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DiagramEditorWizard::onAddBayClicked()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void DiagramEditorWizard::onAddTransClicked()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void DiagramEditorWizard::onDelegateFinishEdit(const QModelIndex &index, const QString &value)
|
||||||
|
{
|
||||||
|
int row = index.row();
|
||||||
|
int col = index.column();
|
||||||
|
if(_mapBus.contains(row)){
|
||||||
|
if(col == 1){
|
||||||
|
_mapBus[row].dVoltage = value.toDouble();
|
||||||
|
}
|
||||||
|
else if(col == 2){
|
||||||
|
_mapBus[row].nLineType = value.toInt();
|
||||||
|
QTableWidgetItem *divideItem = ui->tableWidget_bus->item(row, 3);
|
||||||
|
divideItem->setText("未设置");
|
||||||
|
divideItem->setData(Qt::UserRole,0);
|
||||||
|
}
|
||||||
|
else if(col == 3){
|
||||||
|
_mapBus[row].mapDivide.clear();
|
||||||
|
QStringList lst = value.split(",");
|
||||||
|
if(lst.size() > 1) //双母
|
||||||
|
{
|
||||||
|
_mapBus[row].mapDivide[0] = lst[0].toInt();
|
||||||
|
_mapBus[row].mapDivide[1] = lst[1].toInt();
|
||||||
|
}
|
||||||
|
else{ //单母
|
||||||
|
_mapBus[row].mapDivide[0] = lst[0].toInt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(col == 4){
|
||||||
|
_mapBus[row].connectType = value.toInt();
|
||||||
|
}
|
||||||
|
_busPageChanged = true;
|
||||||
|
//qDebug() << row<<","<<col<<":"<<value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DiagramEditorWizard::onBusDeleteClicked()
|
||||||
|
{
|
||||||
|
// 获取当前选中的索引
|
||||||
|
QMessageBox msgBox;
|
||||||
|
msgBox.setText(QString::fromWCharArray(L"提示"));
|
||||||
|
msgBox.setInformativeText(QString::fromWCharArray(L"确认删除?"));
|
||||||
|
msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
|
||||||
|
msgBox.setDefaultButton(QMessageBox::Cancel);
|
||||||
|
int ret = msgBox.exec();
|
||||||
|
switch (ret) {
|
||||||
|
case QMessageBox::Ok:
|
||||||
|
{
|
||||||
|
QModelIndexList selectedIndexes = ui->tableWidget_bus->selectionModel()->selectedRows();
|
||||||
|
if (selectedIndexes.isEmpty()) {
|
||||||
|
return; // 没有选中任何行
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取当前选中的第一项索引
|
||||||
|
QModelIndex index = selectedIndexes.first();
|
||||||
|
if (!index.isValid()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QModelIndex indexName = index.sibling(index.row(),0);
|
||||||
|
int nIndex = indexName.data(Qt::UserRole).toInt();
|
||||||
|
if(_mapBus.contains(nIndex)){
|
||||||
|
DiagramEditorBusInfo info = _mapBus.take(nIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
int currentRow = ui->tableWidget_bus->currentRow();
|
||||||
|
if (currentRow == -1) {
|
||||||
|
return; // 没有选中行
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->tableWidget_bus->removeRow(currentRow);
|
||||||
|
reOrderBus();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case QMessageBox::Cancel:
|
||||||
|
// Cancel was clicked
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// should never be reached
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DiagramEditorWizard::onBusIndexRbtnClicked(const QPoint &pos)
|
||||||
|
{
|
||||||
|
// 获取当前点击的位置对应的索引
|
||||||
|
QModelIndex index = ui->tableWidget_bus->indexAt(pos);
|
||||||
|
if (!index.isValid()) {
|
||||||
|
return; // 如果点击的是空白区域,直接返回
|
||||||
|
}
|
||||||
|
|
||||||
|
QMenu menu;
|
||||||
|
QAction *deleteAction = new QAction("删除本层", this);
|
||||||
|
menu.addAction(deleteAction);
|
||||||
|
|
||||||
|
// 连接删除菜单项的触发信号与槽函数
|
||||||
|
connect(deleteAction, &QAction::triggered, this, &DiagramEditorWizard::onBusDeleteClicked);
|
||||||
|
|
||||||
|
// 在点击位置显示菜单
|
||||||
|
menu.exec(ui->tableWidget_bus->mapToGlobal(pos));
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ EditPanel::~EditPanel()
|
||||||
|
|
||||||
void EditPanel::initByWizardInfo(DiagramEditorWizardInfo info)
|
void EditPanel::initByWizardInfo(DiagramEditorWizardInfo info)
|
||||||
{
|
{
|
||||||
if(info.bus_220_num != 0)
|
/*if(info.bus_220_num != 0)
|
||||||
{
|
{
|
||||||
if(info.bus_220_num == 1)
|
if(info.bus_220_num == 1)
|
||||||
{
|
{
|
||||||
|
|
@ -87,7 +87,7 @@ void EditPanel::initByWizardInfo(DiagramEditorWizardInfo info)
|
||||||
_widgetLayout->addItem(layoutRowData);
|
_widgetLayout->addItem(layoutRowData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_widgetLayout->addStretch();
|
_widgetLayout->addStretch();*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditPanel::resizeEvent(QResizeEvent* e)
|
void EditPanel::resizeEvent(QResizeEvent* e)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,237 @@
|
||||||
|
#include <QComboBox>
|
||||||
|
#include <QEvent>
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QLabel>
|
||||||
|
|
||||||
|
#include "diagramEditor/wizardBusTableDelegate.h"
|
||||||
|
#include "global.h"
|
||||||
|
|
||||||
|
WizardBusTableDelegate::WizardBusTableDelegate(QObject *parent)
|
||||||
|
: QStyledItemDelegate(parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
WizardBusTableDelegate::~WizardBusTableDelegate()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
QWidget* WizardBusTableDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option,
|
||||||
|
const QModelIndex& index) const
|
||||||
|
{
|
||||||
|
if(index.column() == 1) //电压
|
||||||
|
{
|
||||||
|
QComboBox *editor = new QComboBox(parent);
|
||||||
|
editor->addItem("220KV",QVariant(220));
|
||||||
|
editor->addItem("110KV",QVariant(110));
|
||||||
|
editor->addItem("35KV",QVariant(35));
|
||||||
|
editor->addItem("10KV",QVariant(10));
|
||||||
|
editor->addItem("6KV",QVariant(6));
|
||||||
|
editor->addItem("0.4KV",QVariant(0.4));
|
||||||
|
return editor;
|
||||||
|
}
|
||||||
|
else if(index.column() == 2) //单双母
|
||||||
|
{
|
||||||
|
QComboBox *editor = new QComboBox(parent);
|
||||||
|
editor->addItem("双母线",2);
|
||||||
|
editor->addItem("单母线",1);
|
||||||
|
return editor;
|
||||||
|
}
|
||||||
|
else if(index.column() == 4) //接线方式
|
||||||
|
{
|
||||||
|
QComboBox *editor = new QComboBox(parent);
|
||||||
|
editor->addItems({"分段连接"});
|
||||||
|
return editor;
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*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 WizardBusTableDelegate::setEditorData(QWidget* editor, const QModelIndex& index) const
|
||||||
|
{
|
||||||
|
if(index.column() == 1 || index.column() == 2 || index.column() == 4)
|
||||||
|
{
|
||||||
|
QComboBox* comboBox = static_cast<QComboBox*>(editor);
|
||||||
|
comboBox->setCurrentText(index.data(Qt::EditRole).toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void WizardBusTableDelegate::setModelData(QWidget* editor, QAbstractItemModel* model,
|
||||||
|
const QModelIndex& index) const
|
||||||
|
{
|
||||||
|
if(index.column() == 1 || index.column() == 2 || index.column() == 4)
|
||||||
|
{
|
||||||
|
QComboBox* comboBox = static_cast<QComboBox*>(editor);
|
||||||
|
QVariant data = comboBox->currentData();
|
||||||
|
QVariant lastData = index.data(Qt::UserRole);
|
||||||
|
//model->setData(index,lastData,Qt::UserRole+1); //将旧数据保存到role+1
|
||||||
|
model->setData(index, comboBox->currentText(), Qt::EditRole);
|
||||||
|
model->setData(index, data, Qt::UserRole); // 关联数据
|
||||||
|
//if(index.data(Qt::UserRole) != index.data(Qt::UserRole+1)) //状态改变时才发送
|
||||||
|
{
|
||||||
|
emit editingFinished(index, data.toString()); //发送自定义信号
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool WizardBusTableDelegate::editorEvent(QEvent* event, QAbstractItemModel* model,
|
||||||
|
const QStyleOptionViewItem& option, const QModelIndex& index)
|
||||||
|
{
|
||||||
|
if (event->type() == QEvent::MouseButtonPress) {
|
||||||
|
if(index.column() == 3)
|
||||||
|
{
|
||||||
|
QDialog dialog(option.widget->parentWidget());
|
||||||
|
dialog.setWindowTitle("选择分段");
|
||||||
|
dialog.resize(300, 150);
|
||||||
|
|
||||||
|
QModelIndex typeIndex = index.sibling(index.row(), 2);
|
||||||
|
int nData = typeIndex.data(Qt::UserRole).toInt();
|
||||||
|
if(nData == 2) //双母
|
||||||
|
{
|
||||||
|
// 创建两个组合框并添加数据
|
||||||
|
QComboBox *combo1 = new QComboBox(&dialog);
|
||||||
|
combo1->addItem("不分段", QVariant(1));
|
||||||
|
combo1->addItem("2", QVariant(2));
|
||||||
|
combo1->addItem("3", QVariant(3));
|
||||||
|
combo1->addItem("4", QVariant(4));
|
||||||
|
combo1->addItem("5", QVariant(5));
|
||||||
|
combo1->addItem("6", QVariant(6));
|
||||||
|
combo1->addItem("7", QVariant(7));
|
||||||
|
combo1->addItem("8", QVariant(8));
|
||||||
|
|
||||||
|
QComboBox *combo2 = new QComboBox(&dialog);
|
||||||
|
combo2->addItem("不分段", QVariant(1));
|
||||||
|
combo2->addItem("2", QVariant(2));
|
||||||
|
combo2->addItem("3", QVariant(3));
|
||||||
|
combo2->addItem("4", QVariant(4));
|
||||||
|
combo2->addItem("5", QVariant(5));
|
||||||
|
combo2->addItem("6", QVariant(6));
|
||||||
|
combo2->addItem("7", QVariant(7));
|
||||||
|
combo2->addItem("8", QVariant(8));
|
||||||
|
|
||||||
|
// 确定按钮
|
||||||
|
QPushButton *btnOk = new QPushButton("确定", &dialog);
|
||||||
|
connect(btnOk, &QPushButton::clicked, &dialog, &QDialog::accept);
|
||||||
|
|
||||||
|
// 布局
|
||||||
|
QVBoxLayout *layout = new QVBoxLayout(&dialog);
|
||||||
|
QLabel *label1 = new QLabel("母线1:", &dialog);
|
||||||
|
layout->addWidget(label1);
|
||||||
|
layout->addWidget(combo1);
|
||||||
|
|
||||||
|
QLabel *label2 = new QLabel("母线2:", &dialog);
|
||||||
|
layout->addWidget(label2);
|
||||||
|
layout->addWidget(combo2);
|
||||||
|
|
||||||
|
QHBoxLayout *btnLayout = new QHBoxLayout;
|
||||||
|
btnLayout->addStretch();
|
||||||
|
btnLayout->addWidget(btnOk);
|
||||||
|
layout->addLayout(btnLayout);
|
||||||
|
|
||||||
|
// 显示对话框
|
||||||
|
if (dialog.exec() == QDialog::Accepted) {
|
||||||
|
// 获取两个组合框的文本和数据
|
||||||
|
QString text1 = combo1->currentText();
|
||||||
|
QVariant data1 = combo1->currentData();
|
||||||
|
|
||||||
|
QString text2 = combo2->currentText();
|
||||||
|
QVariant data2 = combo2->currentData();
|
||||||
|
|
||||||
|
// 组合显示文本
|
||||||
|
QString displayText = text1 + ";" + text2;
|
||||||
|
|
||||||
|
// 组合数据(使用自定义格式)
|
||||||
|
QVariant combinedData = QString("%1,%2").arg(data1.toInt()).arg(data2.toInt());
|
||||||
|
|
||||||
|
// 保存到模型
|
||||||
|
model->setData(index, displayText, Qt::DisplayRole); // 显示文本
|
||||||
|
model->setData(index, combinedData, Qt::UserRole); // 关联数据
|
||||||
|
|
||||||
|
emit editingFinished(index, combinedData.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{ //单母
|
||||||
|
// 1个组合框并添加数据
|
||||||
|
QComboBox *combo1 = new QComboBox(&dialog);
|
||||||
|
combo1->addItem("不分段", QVariant(1));
|
||||||
|
combo1->addItem("2", QVariant(2));
|
||||||
|
combo1->addItem("3", QVariant(3));
|
||||||
|
combo1->addItem("4", QVariant(4));
|
||||||
|
combo1->addItem("5", QVariant(5));
|
||||||
|
combo1->addItem("6", QVariant(6));
|
||||||
|
combo1->addItem("7", QVariant(7));
|
||||||
|
combo1->addItem("8", QVariant(8));
|
||||||
|
|
||||||
|
// 确定按钮
|
||||||
|
QPushButton *btnOk = new QPushButton("确定", &dialog);
|
||||||
|
connect(btnOk, &QPushButton::clicked, &dialog, &QDialog::accept);
|
||||||
|
|
||||||
|
// 布局
|
||||||
|
QHBoxLayout *layout = new QHBoxLayout(&dialog);
|
||||||
|
QLabel *label1 = new QLabel("母线:", &dialog);
|
||||||
|
layout->addWidget(label1);
|
||||||
|
layout->addWidget(combo1);
|
||||||
|
|
||||||
|
|
||||||
|
QVBoxLayout *btnLayout = new QVBoxLayout;
|
||||||
|
btnLayout->addStretch();
|
||||||
|
btnLayout->addWidget(btnOk);
|
||||||
|
layout->addLayout(btnLayout);
|
||||||
|
|
||||||
|
// 显示对话框
|
||||||
|
if (dialog.exec() == QDialog::Accepted) {
|
||||||
|
// 获取两个组合框的文本和数据
|
||||||
|
QString text1 = combo1->currentText();
|
||||||
|
QVariant data1 = combo1->currentData();
|
||||||
|
|
||||||
|
// 组合显示文本
|
||||||
|
QString displayText = "分段:"+text1;
|
||||||
|
|
||||||
|
// 组合数据(使用自定义格式)
|
||||||
|
QVariant combinedData = QString("%1").arg(data1.toInt());
|
||||||
|
|
||||||
|
// 保存到模型
|
||||||
|
model->setData(index, displayText, Qt::DisplayRole); // 显示文本
|
||||||
|
model->setData(index, combinedData, Qt::UserRole); // 关联数据
|
||||||
|
|
||||||
|
emit editingFinished(index, combinedData.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return QStyledItemDelegate::editorEvent(event, model, option, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*void WizardBusTableDelegate::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());
|
||||||
|
|
||||||
|
//先执行默认绘制(包括背景、文本等基础元素)
|
||||||
|
QStyledItemDelegate::paint(painter, opt, index);
|
||||||
|
|
||||||
|
}*/
|
||||||
|
|
@ -67,6 +67,7 @@ PowerEntity* TopologyManager::findEntity(const QString& id,ModelFunctionType fun
|
||||||
return m_entities.value(id, nullptr); // 避免异常的安全查询
|
return m_entities.value(id, nullptr); // 避免异常的安全查询
|
||||||
else if(funType == ModelFunctionType::BaseModel)
|
else if(funType == ModelFunctionType::BaseModel)
|
||||||
return m_baseEntities.value(id, nullptr);
|
return m_baseEntities.value(id, nullptr);
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TopologyManager::deleteEntity(const QString& id,ModelFunctionType funType)
|
bool TopologyManager::deleteEntity(const QString& id,ModelFunctionType funType)
|
||||||
|
|
@ -131,6 +132,7 @@ bool TopologyManager::deleteEntity(const QString& id,ModelFunctionType funType)
|
||||||
emit entityDeleted(id);
|
emit entityDeleted(id);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -206,6 +208,7 @@ QList<PowerConnection*> TopologyManager::getConnectionsForTerminal(const QString
|
||||||
return m_connectionIndex.values(terminalId);
|
return m_connectionIndex.values(terminalId);
|
||||||
else if(funType == ModelFunctionType::BaseModel)
|
else if(funType == ModelFunctionType::BaseModel)
|
||||||
return m_baseConnectionIndex.values(terminalId);
|
return m_baseConnectionIndex.values(terminalId);
|
||||||
|
return QList<PowerConnection*>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TopologyManager::removeConnection(const QString& connId,ModelFunctionType funType)
|
void TopologyManager::removeConnection(const QString& connId,ModelFunctionType funType)
|
||||||
|
|
@ -296,6 +299,7 @@ bool TopologyManager::validateConnection(const QString& fromTermId, const QStrin
|
||||||
// 禁止自连接
|
// 禁止自连接
|
||||||
return (fromTerm->parentEntityId() != toTerm->parentEntityId());
|
return (fromTerm->parentEntityId() != toTerm->parentEntityId());
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 连接查询接口
|
// 连接查询接口
|
||||||
|
|
@ -384,6 +388,7 @@ QHash<QString,PowerConnection*> TopologyManager::getAllConnections(ModelFunction
|
||||||
return m_connections;
|
return m_connections;
|
||||||
else if(funType == ModelFunctionType::BaseModel)
|
else if(funType == ModelFunctionType::BaseModel)
|
||||||
return m_baseConnections;
|
return m_baseConnections;
|
||||||
|
return QHash<QString,PowerConnection*>();
|
||||||
}
|
}
|
||||||
|
|
||||||
PowerEntity* TopologyManager::getEntity(const QString& id,ModelFunctionType funType) const
|
PowerEntity* TopologyManager::getEntity(const QString& id,ModelFunctionType funType) const
|
||||||
|
|
@ -497,6 +502,7 @@ bool TopologyManager::deleteDiagram(const QString& id,ModelFunctionType funType)
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
PowerTerminal* TopologyManager::createTerminal(const QString& parentEntityId,
|
PowerTerminal* TopologyManager::createTerminal(const QString& parentEntityId,
|
||||||
|
|
@ -533,6 +539,7 @@ PowerTerminal* TopologyManager::createTerminal(const QString& parentEntityId,
|
||||||
|
|
||||||
return term;
|
return term;
|
||||||
}
|
}
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TopologyManager::deleteTerminal(const QString& terminalId,ModelFunctionType funType) {
|
bool TopologyManager::deleteTerminal(const QString& terminalId,ModelFunctionType funType) {
|
||||||
|
|
@ -570,7 +577,7 @@ bool TopologyManager::deleteTerminal(const QString& terminalId,ModelFunctionType
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
PowerTerminal* TopologyManager::getTerminal(const QString& terminalId,ModelFunctionType funType) const
|
PowerTerminal* TopologyManager::getTerminal(const QString& terminalId,ModelFunctionType funType) const
|
||||||
|
|
@ -591,6 +598,7 @@ QList<PowerTerminal*> TopologyManager::getTerminalsForEntity(const QString& enti
|
||||||
return m_terminalsByEntity.value(entityId);
|
return m_terminalsByEntity.value(entityId);
|
||||||
else if(funType == ModelFunctionType::BaseModel)
|
else if(funType == ModelFunctionType::BaseModel)
|
||||||
return m_baseTerminalsByEntity.value(entityId);
|
return m_baseTerminalsByEntity.value(entityId);
|
||||||
|
return QList<PowerTerminal*>();
|
||||||
}
|
}
|
||||||
|
|
||||||
PowerEntity* TopologyManager::getEntityByTerminal(const QString& terminalId,ModelFunctionType funType) const
|
PowerEntity* TopologyManager::getEntityByTerminal(const QString& terminalId,ModelFunctionType funType) const
|
||||||
|
|
|
||||||
|
|
@ -531,7 +531,7 @@ void BaseSelector::contextMenuEvent(QGraphicsSceneContextMenuEvent *event,Design
|
||||||
if(item)
|
if(item)
|
||||||
{
|
{
|
||||||
GraphicsItemType tpe = item->getItemType();
|
GraphicsItemType tpe = item->getItemType();
|
||||||
if(tpe > QGraphicsItem::UserType && tpe < QGraphicsItem::UserType+1000)
|
if(int(tpe) > QGraphicsItem::UserType && int(tpe) < QGraphicsItem::UserType+1000)
|
||||||
{
|
{
|
||||||
if(_model)
|
if(_model)
|
||||||
_model->deleteNodeItem(item);
|
_model->deleteNodeItem(item);
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>536</width>
|
<width>726</width>
|
||||||
<height>413</height>
|
<height>532</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="font">
|
<property name="font">
|
||||||
|
|
@ -19,295 +19,8 @@
|
||||||
<string>Dialog</string>
|
<string>Dialog</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<property name="leftMargin">
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<property name="horizontalSpacing">
|
|
||||||
<number>4</number>
|
|
||||||
</property>
|
|
||||||
<property name="verticalSpacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="0" colspan="4">
|
|
||||||
<widget class="QStackedWidget" name="stackedWidget">
|
|
||||||
<property name="currentIndex">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="page_bus">
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="groupBox">
|
|
||||||
<property name="title">
|
|
||||||
<string>母线设置</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="groupBox_2">
|
|
||||||
<property name="title">
|
|
||||||
<string>220KV</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="1,3,1,3,1,3">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="text">
|
|
||||||
<string>数量</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="cb_num_220">
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>无</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>单母线</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>双母线</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="text">
|
|
||||||
<string>分段方式</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="cb_div_220">
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>1</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>2</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>3</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>4</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_3">
|
|
||||||
<property name="text">
|
|
||||||
<string>回路数量</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QSpinBox" name="sp_circuit_220"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="groupBox_3">
|
|
||||||
<property name="title">
|
|
||||||
<string>110KV</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="1,3,1,3,1,3">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_4">
|
|
||||||
<property name="text">
|
|
||||||
<string>数量</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="cb_num_110">
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>无</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>单母线</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>双母线</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_5">
|
|
||||||
<property name="text">
|
|
||||||
<string>分段方式</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="cb_div_110">
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>1</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>2</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>3</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>4</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_6">
|
|
||||||
<property name="text">
|
|
||||||
<string>回路数量</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QSpinBox" name="sp_circuit_110"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="groupBox_4">
|
|
||||||
<property name="title">
|
|
||||||
<string>35KV</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4" stretch="1,3,1,3,1,3">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_7">
|
|
||||||
<property name="text">
|
|
||||||
<string>数量</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="cb_num_35">
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>无</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>单母线</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>双母线</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_8">
|
|
||||||
<property name="text">
|
|
||||||
<string>分段方式</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="cb_div_35">
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>1</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>2</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>3</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>4</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_9">
|
|
||||||
<property name="text">
|
|
||||||
<string>回路数量</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QSpinBox" name="sp_circuit_35"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="page_circuit"/>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Orientation::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>139</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QPushButton" name="btn_last">
|
|
||||||
<property name="text">
|
|
||||||
<string>上一步</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="2">
|
<item row="1" column="2">
|
||||||
<widget class="QStackedWidget" name="stackedWidget_btn">
|
<widget class="QStackedWidget" name="stackedWidget_next">
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>80</width>
|
<width>80</width>
|
||||||
|
|
@ -371,6 +84,208 @@
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="0" colspan="4">
|
||||||
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="tab_bus">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>设置母线</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<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>
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>611</width>
|
||||||
|
<height>17</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QPushButton" name="btn_addBus">
|
||||||
|
<property name="text">
|
||||||
|
<string>添加</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" colspan="2">
|
||||||
|
<widget class="QTableWidget" name="tableWidget_bus">
|
||||||
|
<attribute name="horizontalHeaderVisible">
|
||||||
|
<bool>true</bool>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="verticalHeaderVisible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tab_bay">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>设置间隔</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_3" columnstretch="1,3">
|
||||||
|
<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>
|
||||||
|
<property name="horizontalSpacing">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="verticalSpacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0" rowspan="2">
|
||||||
|
<widget class="QListWidget" name="listWidget_bay"/>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QWidget" name="widget" native="true">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<property name="spacing">
|
||||||
|
<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_level">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>12</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">color: rgb(0, 0, 0);</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>第N层</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>396</width>
|
||||||
|
<height>16</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btn_addBay">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>12</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>添加</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QStackedWidget" name="stackedWidget"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tab_trans">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>设置变压器</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_4">
|
||||||
|
<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>
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<spacer name="horizontalSpacer_4">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>611</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QPushButton" name="btn_addTrans">
|
||||||
|
<property name="text">
|
||||||
|
<string>添加</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" colspan="2">
|
||||||
|
<widget class="QTableWidget" name="tableWidget_trans"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="1" column="3">
|
<item row="1" column="3">
|
||||||
<widget class="QPushButton" name="btn_cancel">
|
<widget class="QPushButton" name="btn_cancel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|
@ -378,6 +293,77 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>139</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QStackedWidget" name="stackedWidget_last">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>80</width>
|
||||||
|
<height>22</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="page_null">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<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>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="page_last">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_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="QPushButton" name="btn_last">
|
||||||
|
<property name="text">
|
||||||
|
<string>上一步</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
|
|
||||||
|
|
@ -2552,9 +2552,9 @@ QList<measureAttributeType> DataBase::getMeasureAttributeTypes()
|
||||||
}
|
}
|
||||||
catch (const std::exception& e)
|
catch (const std::exception& e)
|
||||||
{
|
{
|
||||||
return lst;
|
|
||||||
LOG_ERROR("DB", QString("Select measureAttributeType fail"));
|
LOG_ERROR("DB", QString("Select measureAttributeType fail"));
|
||||||
}
|
}
|
||||||
|
return lst;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DataBase::createDynamicTable(const QString &tableName, const QStringList &fields)
|
bool DataBase::createDynamicTable(const QString &tableName, const QStringList &fields)
|
||||||
|
|
@ -2663,6 +2663,7 @@ bool DataBase::ifDynamicTableExist(const QString& sTable)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DataBase::updateProjectName(const QString& newTable,const QString& newPro,const QString& oldTable)
|
bool DataBase::updateProjectName(const QString& newTable,const QString& newPro,const QString& oldTable)
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ ProjectModelManager::ProjectModelManager(QObject *parent)
|
||||||
|
|
||||||
ProjectModelManager::~ProjectModelManager()
|
ProjectModelManager::~ProjectModelManager()
|
||||||
{
|
{
|
||||||
|
m_mapTotalData.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectModelManager::initialModel()
|
void ProjectModelManager::initialModel()
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ QWidget* ProjectTableDelegate::createEditor(QWidget* parent, const QStyleOptionV
|
||||||
|
|
||||||
return editor;
|
return editor;
|
||||||
}
|
}
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*bool ProjectTableDelegate::eventFilter(QObject* obj, QEvent* event)
|
/*bool ProjectTableDelegate::eventFilter(QObject* obj, QEvent* event)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue