DiagramDesigner/diagramCavas/source/diagramEditor/wizardBayContentDlg.cpp

75 lines
1.9 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "diagramEditor/wizardBayContentDlg.h"
#include <QHeaderView>
WizardBayContentDlg::WizardBayContentDlg(QWidget *parent)
: QTableWidget(parent)
{
initial();
}
WizardBayContentDlg::~WizardBayContentDlg()
{
}
void WizardBayContentDlg::initial()
{
_curPageIndex = 0;
QStringList headerText;
headerText<<"间隔名称"<<"间隔类型"<<"连接对象";
setContextMenuPolicy(Qt::CustomContextMenu);
setSelectionMode(QAbstractItemView::SingleSelection);
setSelectionBehavior(QAbstractItemView::SelectRows);
setColumnCount(headerText.count());
setHorizontalHeaderLabels(headerText);
horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
}
void WizardBayContentDlg::addBay(DiagramEditorWizardBayInfo obj)
{
int row = rowCount();
insertRow(row);
//名称
QTableWidgetItem* nameItem = new QTableWidgetItem(obj.sName);
setItem(row, 0, nameItem);
QString sType;
switch (obj.nType) {//0分段间隔1母联间隔2pt间隔3进线间隔4出线间隔5无功补偿间隔6旁路间隔
case BayType::busSectionBay:
sType = "分段间隔";
break;
case BayType::busCouplerBay:
sType = "母联间隔";
break;
case BayType::ptBay:
sType = "pt间隔";
break;
case BayType::incomingBay:
sType = "进线间隔";
break;
case BayType::outcomingBay:
sType = "出线间隔";
break;
case BayType::compensationBay:
sType = "无功补偿间隔";
break;
case BayType::bypassBay:
sType = "旁路间隔";
break;
default:
break;
}
//类型
QTableWidgetItem* typeItem = new QTableWidgetItem(sType);
setItem(row, 1, typeItem);
// 主接线
QTableWidgetItem* connectItem = new QTableWidgetItem(obj.lstBindObj.join(""));
setItem(row, 2, connectItem);
}
void WizardBayContentDlg::clearData()
{
clear();
}