更新
This commit is contained in:
parent
734ab428cd
commit
fd15c989d2
@ -1,6 +1,72 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="zh_CN">
|
||||
<context>
|
||||
<name>AddParamSetting</name>
|
||||
<message>
|
||||
<location filename="../ui/Layout/AddParamSetting.cpp" line="50"/>
|
||||
<source>ParamSetting</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AddParamSettingClass</name>
|
||||
<message>
|
||||
<location filename="../ui/Layout/AddParamSetting.ui" line="14"/>
|
||||
<source>AddParamSetting</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/Layout/AddParamSetting.ui" line="21"/>
|
||||
<source>参数名称</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/Layout/AddParamSetting.ui" line="26"/>
|
||||
<source>描述</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/Layout/AddParamSetting.ui" line="31"/>
|
||||
<source>数据类型</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/Layout/AddParamSetting.ui" line="36"/>
|
||||
<source>最大值</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/Layout/AddParamSetting.ui" line="41"/>
|
||||
<source>最小值</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/Layout/AddParamSetting.ui" line="46"/>
|
||||
<source>小数点有效位</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/Layout/AddParamSetting.ui" line="51"/>
|
||||
<source>初始值</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/Layout/AddParamSetting.ui" line="67"/>
|
||||
<source>添加</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/Layout/AddParamSetting.ui" line="80"/>
|
||||
<source>删除</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/Layout/AddParamSetting.ui" line="93"/>
|
||||
<source>应用</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ChartPlotMenuClass</name>
|
||||
<message>
|
||||
@ -322,52 +388,57 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/MainWindow.cpp" line="67"/>
|
||||
<location filename="../ui/MainWindow.cpp" line="69"/>
|
||||
<source>model elements</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/MainWindow.cpp" line="73"/>
|
||||
<location filename="../ui/MainWindow.cpp" line="75"/>
|
||||
<source>attribte</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/MainWindow.cpp" line="89"/>
|
||||
<location filename="../ui/MainWindow.cpp" line="91"/>
|
||||
<source>Wave Curve</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/MainWindow.cpp" line="99"/>
|
||||
<location filename="../ui/MainWindow.cpp" line="101"/>
|
||||
<source>Speed Curve</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/MainWindow.cpp" line="109"/>
|
||||
<location filename="../ui/MainWindow.cpp" line="111"/>
|
||||
<source>3D Curve</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/MainWindow.cpp" line="137"/>
|
||||
<location filename="../ui/MainWindow.cpp" line="139"/>
|
||||
<source>Report Table</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/MainWindow.cpp" line="163"/>
|
||||
<location filename="../ui/MainWindow.cpp" line="165"/>
|
||||
<source>Report</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/MainWindow.cpp" line="174"/>
|
||||
<location filename="../ui/MainWindow.cpp" line="176"/>
|
||||
<source>Signal Indicator Lamp</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/MainWindow.cpp" line="183"/>
|
||||
<location filename="../ui/MainWindow.cpp" line="185"/>
|
||||
<source>ParamSetting</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/MainWindow.cpp" line="190"/>
|
||||
<source>name: 5year 0412</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/MainWindow.cpp" line="184"/>
|
||||
<location filename="../ui/MainWindow.cpp" line="191"/>
|
||||
<source>start: no start</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@ -401,57 +472,57 @@
|
||||
<context>
|
||||
<name>ModelTreeWidget</name>
|
||||
<message>
|
||||
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="96"/>
|
||||
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="110"/>
|
||||
<source>Release Track</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="113"/>
|
||||
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="127"/>
|
||||
<source>Add boke Entity</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="120"/>
|
||||
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="134"/>
|
||||
<source>Add lsjhqt Entity</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="127"/>
|
||||
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="141"/>
|
||||
<source>Add nimizi Entity</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="134"/>
|
||||
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="148"/>
|
||||
<source>Add tkdlj Entity</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="141"/>
|
||||
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="155"/>
|
||||
<source>Add jiaofan Entity</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="148"/>
|
||||
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="162"/>
|
||||
<source>Add satellite Entity</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="250"/>
|
||||
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="264"/>
|
||||
<source>Track</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="258"/>
|
||||
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="272"/>
|
||||
<source>Add Mesh Component</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="262"/>
|
||||
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="276"/>
|
||||
<source>Add Path Component</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="269"/>
|
||||
<location filename="../ui/ModelBrowser/ModelTreeWidget.cpp" line="283"/>
|
||||
<source>Delete</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@ -690,34 +761,24 @@
|
||||
<context>
|
||||
<name>QtConeWaveComponentManager</name>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8347"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8356"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8326"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8335"/>
|
||||
<source>ConeWaveComponent</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8437"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8414"/>
|
||||
<source>Height</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8444"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8421"/>
|
||||
<source>Radius</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8451"/>
|
||||
<source>Color1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8458"/>
|
||||
<source>Color2</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8465"/>
|
||||
<source>Color3</source>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8428"/>
|
||||
<source>Color</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
@ -822,28 +883,28 @@
|
||||
<context>
|
||||
<name>QtDashedLineComponentManager</name>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8636"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8645"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8585"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8594"/>
|
||||
<source>DashedLineComponent</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8714"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8663"/>
|
||||
<source>Start</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8721"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8670"/>
|
||||
<source>End</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8728"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8677"/>
|
||||
<source>Radius</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8735"/>
|
||||
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8684"/>
|
||||
<source>Color</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@ -1288,7 +1349,7 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/chartPlot/SurfaceDialog.cpp" line="37"/>
|
||||
<location filename="../ui/chartPlot/SurfaceDialog.cpp" line="38"/>
|
||||
<source>3D Curve</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
349
Source/src/ui/Layout/AddParamSetting.cpp
Normal file
349
Source/src/ui/Layout/AddParamSetting.cpp
Normal file
@ -0,0 +1,349 @@
|
||||
#include "AddParamSetting.h"
|
||||
|
||||
#include "../DockTitleBar.h"
|
||||
#include "../DockWidget.h"
|
||||
|
||||
#include <qcombobox.h>
|
||||
#include <QDoubleSpinBox>
|
||||
#include <QSpinBox>
|
||||
|
||||
#include <qsettings.h>
|
||||
#include <qdebug.h>
|
||||
|
||||
AddParamSetting::AddParamSetting(const QString& strDir, QWidget* parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
|
||||
setWindowFlags(/*Qt::FramelessWindowHint | */Qt::Window);
|
||||
|
||||
m_strDir = strDir;
|
||||
|
||||
QHeaderView* horizontalHeader = ui.tableWidget->horizontalHeader();
|
||||
QColor headerColor = QColor(100, 100, 100); // 灰色
|
||||
horizontalHeader->setStyleSheet(QString("QHeaderView::section {background-color: %1;}").arg(headerColor.name()));
|
||||
horizontalHeader->setStretchLastSection(true);
|
||||
|
||||
connect(ui.pushButton, &QPushButton::clicked, this, &AddParamSetting::slotButtonAdd);
|
||||
connect(ui.pushButton_2, &QPushButton::clicked, this, &AddParamSetting::slotButtonRemove);
|
||||
connect(ui.pushButton_3, &QPushButton::clicked, this, &AddParamSetting::slotButtonCommit);
|
||||
|
||||
InitTable();
|
||||
}
|
||||
|
||||
AddParamSetting::~AddParamSetting()
|
||||
{
|
||||
}
|
||||
|
||||
void AddParamSetting::AttachDock(DockWidget* dockWidget)
|
||||
{
|
||||
if (nullptr == dockWidget) {
|
||||
qDebug() << __FUNCTION__ << "dockwidget is nullptr";
|
||||
return;
|
||||
}
|
||||
|
||||
dockWidget->SetDockWidgetTitleBar(nullptr);
|
||||
dockWidget->setWidget(this);
|
||||
|
||||
DockTitleBar* dockTitleBar = new DockTitleBar;
|
||||
|
||||
dockTitleBar->SetTitle(tr("ParamSetting"));
|
||||
|
||||
dockWidget->SetDockWidgetTitleBar(dockTitleBar);
|
||||
}
|
||||
|
||||
void AddParamSetting::InitTable()
|
||||
{
|
||||
QSettings sett(m_strDir, QSettings::IniFormat);
|
||||
|
||||
QStringList listGroup = sett.childGroups();
|
||||
|
||||
for each (QString strGroup in listGroup)
|
||||
{
|
||||
sett.beginGroup(strGroup);
|
||||
|
||||
QString strName = sett.value("Name").toString();
|
||||
QString strDes = sett.value("Des").toString();
|
||||
QString strType = sett.value("Type").toString();
|
||||
QString strMaxValue = sett.value("MaxValue").toString();
|
||||
QString strMinValue = sett.value("MinValue").toString();
|
||||
QString strDecimal = sett.value("Decimal").toString();
|
||||
QString strValue = sett.value("Value","0").toString();
|
||||
|
||||
QStringList values;
|
||||
values << strName << strDes << strType << strMaxValue << strMinValue << strDecimal << strValue;
|
||||
|
||||
InsertRow(values);
|
||||
|
||||
sett.endGroup();
|
||||
}
|
||||
}
|
||||
|
||||
void AddParamSetting::InsertRow()
|
||||
{
|
||||
int iRow = ui.tableWidget->rowCount();
|
||||
ui.tableWidget->insertRow(iRow);
|
||||
|
||||
int iCol = 0;
|
||||
// 参数名称
|
||||
{
|
||||
QString strText = u8"输入参数名称";
|
||||
ui.tableWidget->setItem(iRow, iCol, new QTableWidgetItem(strText));
|
||||
iCol++;
|
||||
}
|
||||
|
||||
// 参数描述
|
||||
{
|
||||
QString strText = u8"输入参数描述";
|
||||
ui.tableWidget->setItem(iRow, iCol, new QTableWidgetItem(strText));
|
||||
iCol++;
|
||||
}
|
||||
|
||||
// 数据类型
|
||||
{
|
||||
QStringList listType;
|
||||
listType << "String" << "Int" << "Float";
|
||||
|
||||
QComboBox* pCombox = new QComboBox;
|
||||
pCombox->addItems(listType);
|
||||
pCombox->setCurrentIndex(0);
|
||||
pCombox->setProperty("Row", iRow);
|
||||
|
||||
ui.tableWidget->setCellWidget(iRow, iCol, pCombox);
|
||||
|
||||
connect(pCombox, &QComboBox::currentTextChanged, this, &AddParamSetting::slotSelectDataType);
|
||||
iCol++;
|
||||
}
|
||||
|
||||
// 最大值
|
||||
{
|
||||
QDoubleSpinBox* pValue = new QDoubleSpinBox;
|
||||
pValue->setDisabled(true);
|
||||
pValue->setValue(100);
|
||||
ui.tableWidget->setCellWidget(iRow, iCol, pValue);
|
||||
iCol++;
|
||||
}
|
||||
|
||||
// 最小值
|
||||
{
|
||||
QDoubleSpinBox* pValue = new QDoubleSpinBox;
|
||||
pValue->setDisabled(true);
|
||||
pValue->setValue(1);
|
||||
ui.tableWidget->setCellWidget(iRow, iCol, pValue);
|
||||
iCol++;
|
||||
}
|
||||
|
||||
// 小数点有效位
|
||||
{
|
||||
QSpinBox* pValue = new QSpinBox;
|
||||
pValue->setDisabled(true);
|
||||
pValue->setValue(0);
|
||||
ui.tableWidget->setCellWidget(iRow, iCol, pValue);
|
||||
iCol++;
|
||||
}
|
||||
|
||||
// 参数描述
|
||||
{
|
||||
QString strText = u8"输入参数值";
|
||||
ui.tableWidget->setItem(iRow, iCol, new QTableWidgetItem(strText));
|
||||
}
|
||||
}
|
||||
|
||||
void AddParamSetting::InsertRow(QStringList values)
|
||||
{
|
||||
int iRow = ui.tableWidget->rowCount();
|
||||
ui.tableWidget->insertRow(iRow);
|
||||
|
||||
int iCol = 0;
|
||||
// 参数名称
|
||||
{
|
||||
QString strText = values[0];
|
||||
ui.tableWidget->setItem(iRow, iCol, new QTableWidgetItem(strText));
|
||||
iCol++;
|
||||
}
|
||||
|
||||
// 参数描述
|
||||
{
|
||||
QString strText = values[1];
|
||||
ui.tableWidget->setItem(iRow, iCol, new QTableWidgetItem(strText));
|
||||
iCol++;
|
||||
}
|
||||
|
||||
// 数据类型
|
||||
{
|
||||
QStringList listType;
|
||||
listType << "String" << "Int" << "Float";
|
||||
|
||||
QComboBox* pCombox = new QComboBox;
|
||||
pCombox->addItems(listType);
|
||||
pCombox->setCurrentText(values[2]);
|
||||
pCombox->setProperty("Row", iRow);
|
||||
|
||||
ui.tableWidget->setCellWidget(iRow, iCol, pCombox);
|
||||
|
||||
connect(pCombox, &QComboBox::currentTextChanged, this, &AddParamSetting::slotSelectDataType);
|
||||
iCol++;
|
||||
}
|
||||
|
||||
// 最大值
|
||||
{
|
||||
QDoubleSpinBox* pValue = new QDoubleSpinBox;
|
||||
|
||||
if (values[2] == "String")
|
||||
{
|
||||
pValue->setDisabled(true);
|
||||
}
|
||||
|
||||
pValue->setValue(values[3].toFloat());
|
||||
|
||||
ui.tableWidget->setCellWidget(iRow, iCol, pValue);
|
||||
iCol++;
|
||||
}
|
||||
|
||||
// 最小值
|
||||
{
|
||||
QDoubleSpinBox* pValue = new QDoubleSpinBox;
|
||||
|
||||
if (values[2] == "String")
|
||||
{
|
||||
pValue->setDisabled(true);
|
||||
}
|
||||
|
||||
pValue->setValue(values[4].toFloat());
|
||||
|
||||
ui.tableWidget->setCellWidget(iRow, iCol, pValue);
|
||||
|
||||
iCol++;
|
||||
}
|
||||
|
||||
// 小数点有效位
|
||||
{
|
||||
QSpinBox* pValue = new QSpinBox;
|
||||
if (values[2] == "String")
|
||||
{
|
||||
pValue->setDisabled(true);
|
||||
}
|
||||
|
||||
pValue->setValue(values[5].toFloat());
|
||||
|
||||
ui.tableWidget->setCellWidget(iRow, iCol, pValue);
|
||||
|
||||
iCol++;
|
||||
}
|
||||
|
||||
// 参数初始值
|
||||
{
|
||||
QString strText = values[6];
|
||||
ui.tableWidget->setItem(iRow, iCol, new QTableWidgetItem(strText));
|
||||
}
|
||||
}
|
||||
|
||||
void AddParamSetting::RemoveRow()
|
||||
{
|
||||
int iRow = ui.tableWidget->currentRow();
|
||||
if (iRow >= 0)
|
||||
{
|
||||
ui.tableWidget->removeRow(iRow);
|
||||
|
||||
ResetTable();
|
||||
}
|
||||
}
|
||||
|
||||
void AddParamSetting::ResetTable()
|
||||
{
|
||||
for (int iRow = 0; iRow < ui.tableWidget->rowCount(); iRow++)
|
||||
{
|
||||
QWidget* pCellWgt = ui.tableWidget->cellWidget(iRow, 2);
|
||||
pCellWgt->setProperty("Row", iRow);
|
||||
}
|
||||
}
|
||||
|
||||
void AddParamSetting::slotButtonAdd()
|
||||
{
|
||||
InsertRow();
|
||||
}
|
||||
|
||||
void AddParamSetting::slotButtonRemove()
|
||||
{
|
||||
RemoveRow();
|
||||
}
|
||||
|
||||
void AddParamSetting::slotButtonCommit()
|
||||
{
|
||||
QSettings sett(m_strDir, QSettings::IniFormat);
|
||||
sett.clear();
|
||||
sett.sync();
|
||||
|
||||
for (int iRow = 0; iRow < ui.tableWidget->rowCount(); iRow++)
|
||||
{
|
||||
QString strGroup = QString::number(iRow + 1);
|
||||
QString strName = ui.tableWidget->item(iRow, 0)->text();
|
||||
QString strDes = ui.tableWidget->item(iRow, 1)->text();
|
||||
QString strType = ((QComboBox*)ui.tableWidget->cellWidget(iRow, 2))->currentText();
|
||||
|
||||
sett.beginGroup(strGroup);
|
||||
|
||||
sett.setValue("Name", strName);
|
||||
sett.setValue("Des", strDes);
|
||||
sett.setValue("Type", strType);
|
||||
|
||||
QDoubleSpinBox* pMaxValue = (QDoubleSpinBox*)ui.tableWidget->cellWidget(iRow, 3);
|
||||
sett.setValue("MaxValue", pMaxValue->value());
|
||||
|
||||
QDoubleSpinBox* pMinValue = (QDoubleSpinBox*)ui.tableWidget->cellWidget(iRow, 4);
|
||||
sett.setValue("MinValue", pMinValue->value());
|
||||
|
||||
QSpinBox* pDecimalValue = (QSpinBox*)ui.tableWidget->cellWidget(iRow, 5);
|
||||
sett.setValue("Decimal", pDecimalValue->value());
|
||||
|
||||
sett.setValue("Value", ui.tableWidget->item(iRow, 6)->text());
|
||||
|
||||
sett.endGroup();
|
||||
}
|
||||
}
|
||||
|
||||
void AddParamSetting::slotSelectDataType(const QString& strType)
|
||||
{
|
||||
QObject* pSender = sender();
|
||||
int iRow = pSender->property("Row").toInt();
|
||||
if (iRow < ui.tableWidget->rowCount())
|
||||
{
|
||||
if ("Int" == strType)
|
||||
{
|
||||
QDoubleSpinBox* pMaxValue = (QDoubleSpinBox*)ui.tableWidget->cellWidget(iRow, 3);
|
||||
pMaxValue->setDecimals(0);
|
||||
pMaxValue->setDisabled(false);
|
||||
|
||||
QDoubleSpinBox* pMinValue = (QDoubleSpinBox*)ui.tableWidget->cellWidget(iRow, 4);
|
||||
pMinValue->setDecimals(0);
|
||||
pMinValue->setDisabled(false);
|
||||
|
||||
QSpinBox* pDecimalValue = (QSpinBox*)ui.tableWidget->cellWidget(iRow, 5);
|
||||
pDecimalValue->setDisabled(true);
|
||||
}
|
||||
else if ("Float" == strType)
|
||||
{
|
||||
QDoubleSpinBox* pMaxValue = (QDoubleSpinBox*)ui.tableWidget->cellWidget(iRow, 3);
|
||||
pMaxValue->setDecimals(0);
|
||||
pMaxValue->setDisabled(false);
|
||||
|
||||
QDoubleSpinBox* pMinValue = (QDoubleSpinBox*)ui.tableWidget->cellWidget(iRow, 4);
|
||||
pMinValue->setDecimals(0);
|
||||
pMinValue->setDisabled(false);
|
||||
|
||||
QSpinBox* pDecimalValue = (QSpinBox*)ui.tableWidget->cellWidget(iRow, 5);
|
||||
pDecimalValue->setDisabled(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
QDoubleSpinBox* pMaxValue = (QDoubleSpinBox*)ui.tableWidget->cellWidget(iRow, 3);
|
||||
pMaxValue->setDisabled(true);
|
||||
|
||||
QDoubleSpinBox* pMinValue = (QDoubleSpinBox*)ui.tableWidget->cellWidget(iRow, 4);
|
||||
pMinValue->setDisabled(true);
|
||||
|
||||
QSpinBox* pDecimalValue = (QSpinBox*)ui.tableWidget->cellWidget(iRow, 5);
|
||||
pDecimalValue->setDisabled(true);
|
||||
}
|
||||
}
|
||||
}
|
35
Source/src/ui/Layout/AddParamSetting.h
Normal file
35
Source/src/ui/Layout/AddParamSetting.h
Normal file
@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include "ui_AddParamSetting.h"
|
||||
|
||||
class AddParamSetting : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AddParamSetting(const QString& strDir, QWidget *parent = nullptr);
|
||||
~AddParamSetting();
|
||||
|
||||
void AttachDock(class DockWidget* dockWidget);
|
||||
|
||||
protected:
|
||||
void InitTable();
|
||||
void InsertRow();
|
||||
void InsertRow(QStringList values);
|
||||
void RemoveRow();
|
||||
|
||||
void ResetTable();
|
||||
|
||||
protected slots:
|
||||
void slotSelectDataType(const QString& strType);
|
||||
|
||||
void slotButtonAdd();
|
||||
void slotButtonRemove();
|
||||
void slotButtonCommit();
|
||||
|
||||
private:
|
||||
Ui::AddParamSettingClass ui;
|
||||
|
||||
QString m_strDir;
|
||||
};
|
117
Source/src/ui/Layout/AddParamSetting.ui
Normal file
117
Source/src/ui/Layout/AddParamSetting.ui
Normal file
@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AddParamSettingClass</class>
|
||||
<widget class="QWidget" name="AddParamSettingClass">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1250</width>
|
||||
<height>598</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>AddParamSetting</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QTableWidget" name="tableWidget">
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>参数名称</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>描述</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>数据类型</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>最大值</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>最小值</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>小数点有效位</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>初始值</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>添加</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_2">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>删除</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_3">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>应用</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -20,6 +20,7 @@
|
||||
#include "chartPlot/SurfaceDialog.h"
|
||||
#include "Layout/LayoutSettingUI.h"
|
||||
#include "Layout/SignalIndicatorLampUI.h"
|
||||
#include "Layout/AddParamSetting.h"
|
||||
|
||||
#include "Table/targetlistwgt.h"
|
||||
#include "common/RecourceHelper.h"
|
||||
@ -29,6 +30,8 @@
|
||||
#include "../workspace/Timestep.h"
|
||||
#include "../workspace/LampStatus.h"
|
||||
|
||||
#include "Matlab/MatlabObject.h"
|
||||
|
||||
#include "ui_MainWindow.h"
|
||||
|
||||
MainWindow::MainWindow(QWidget* parent)
|
||||
@ -179,11 +182,22 @@ void MainWindow::InitUI() {
|
||||
|
||||
m_mapDockWidget.insert("SignalIndicatorLampUI", signalIndicatorLampDock);
|
||||
|
||||
const QString iniPath = RecourceHelper::Get().GetBasePath() + "/workspace/ParamSetting.ini";
|
||||
DockWidget* addParamSettingDock = new DockWidget(tr("ParamSetting"), 0);
|
||||
addParamDlg_ = new AddParamSetting(iniPath);
|
||||
addParamDlg_->AttachDock(addParamSettingDock);
|
||||
m_mapDockWidget.insert("ParamSetting", addParamSettingDock);
|
||||
|
||||
ui->discript->setText(tr("name: 5year 0412"));
|
||||
ui->status->setText(tr("start: no start"));
|
||||
|
||||
InitDockLayout();
|
||||
|
||||
if (0)
|
||||
{
|
||||
MatlabObject* mtlb = new MatlabObject;
|
||||
mtlb->RunMatlabFile("D:\\DYT\\TestGUI\\TestGUI\\LDPlatformTest.m");
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::InitDockLayout()
|
||||
|
@ -62,6 +62,7 @@ private:
|
||||
class TargetListWgt* targetUITable_{ nullptr };
|
||||
class QTabWidget* tabWidget_{ nullptr };
|
||||
class SignalIndicatorLampUI* signalIndicatorLampUI_{ nullptr };
|
||||
class AddParamSetting* addParamDlg_{ nullptr };
|
||||
|
||||
QMap<QString, QDockWidget*> m_mapDockWidget;
|
||||
|
||||
|
@ -28,8 +28,11 @@ void MatlabObject::RunMatlabFile(const QString& strFile)
|
||||
std::u16string utf16_str = string2u16string(strRun);
|
||||
// 启动MATLAB Engine
|
||||
std::unique_ptr<MATLABEngine> matlabPtr = startMATLAB();
|
||||
if (matlabPtr)
|
||||
{
|
||||
// 运行M文件
|
||||
matlabPtr->eval(utf16_str);
|
||||
}
|
||||
}
|
||||
|
||||
std::u16string MatlabObject::string2u16string(std::string& str)
|
||||
|
@ -7,7 +7,7 @@ class MatlabObject : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MatlabObject(QObject *parent);
|
||||
MatlabObject(QObject *parent=nullptr);
|
||||
~MatlabObject();
|
||||
|
||||
void RunMatlabFile(const QString& strFile);
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <QHBoxLayout>
|
||||
#include <QScatterDataItem>
|
||||
#include <QMessageBox>
|
||||
#include <Q3DCamera>
|
||||
|
||||
SurfaceDialog::SurfaceDialog(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
@ -126,7 +127,7 @@ void SurfaceDialog::slotAddSeries(QVariant varSeriesData)
|
||||
m_iMaxZ = fZ;
|
||||
}
|
||||
|
||||
*dataRow << QVector3D(fX, fZ, fY);
|
||||
*dataRow << QVector3D(fX, fY, fZ);
|
||||
}
|
||||
|
||||
*data << dataRow;
|
||||
@ -139,9 +140,6 @@ void SurfaceDialog::slotAddSeries(QVariant varSeriesData)
|
||||
m_p3DYAxis->setRange(m_iMinZ, m_iMaxZ);
|
||||
m_p3DZAxis->setRange(m_iMinY, m_iMaxY);
|
||||
|
||||
//m_p3DZAxis->setRange(m_iMinZ-1, m_iMaxZ+1);
|
||||
//m_p3DYAxis->setRange(m_iMinY-1, m_iMaxY+1);
|
||||
|
||||
// ÉèÖÃÑÕÉ«Ñùʽ
|
||||
m_pSeries->setBaseColor(color);
|
||||
m_pSeries->setColorStyle(Q3DTheme::ColorStyleUniform);
|
||||
@ -221,6 +219,8 @@ void SurfaceDialog::slotUpdateTime(double dTime)
|
||||
m_p3DZAxis->setTitle("z");
|
||||
m_p3DZAxis->setTitleVisible(true);
|
||||
|
||||
m_pSeries->dataProxy()->resetArray(nullptr);
|
||||
|
||||
QSurfaceDataArray* data = new QSurfaceDataArray;
|
||||
|
||||
m_iMinX = 0; m_iMaxX = 0;
|
||||
@ -242,7 +242,7 @@ void SurfaceDialog::slotUpdateTime(double dTime)
|
||||
|
||||
for (int j = 0; j < rowData.size(); j++)
|
||||
{
|
||||
float fZ = rowData[j];
|
||||
float fZ = abs(rowData[j]);
|
||||
|
||||
if (m_iMinZ > fZ)
|
||||
{
|
||||
@ -254,7 +254,7 @@ void SurfaceDialog::slotUpdateTime(double dTime)
|
||||
m_iMaxZ = fZ;
|
||||
}
|
||||
|
||||
*dataRow << QVector3D(i+1, j+1, fZ);
|
||||
*dataRow << QVector3D(i+1, fZ, j+1);
|
||||
}
|
||||
|
||||
*data << dataRow;
|
||||
@ -263,11 +263,12 @@ void SurfaceDialog::slotUpdateTime(double dTime)
|
||||
m_pSeries->dataProxy()->resetArray(data);
|
||||
|
||||
m_p3DXAxis->setRange(m_iMinX, m_iMaxX);
|
||||
m_p3DZAxis->setRange(m_iMinZ, m_iMaxZ);
|
||||
m_p3DYAxis->setRange(m_iMinY, m_iMaxY);
|
||||
m_p3DYAxis->setRange(m_iMinZ, m_iMaxZ);
|
||||
m_p3DZAxis->setRange(m_iMinY, m_iMaxY);
|
||||
|
||||
//m_p3DZAxis->setRange(m_iMinZ-1, m_iMaxZ+1);
|
||||
//m_p3DYAxis->setRange(m_iMinY-1, m_iMaxY+1);
|
||||
|
||||
m_Surface.setHorizontalAspectRatio(2.1);
|
||||
m_Surface.setShadowQuality(QAbstract3DGraph::ShadowQuality::ShadowQualityNone);
|
||||
}
|
||||
|
||||
void SurfaceDialog::InitSurface()
|
||||
@ -309,6 +310,9 @@ void SurfaceDialog::InitSurface()
|
||||
m_pSeries->setBaseColor(Qt::green);
|
||||
m_pSeries->setColorStyle(Q3DTheme::ColorStyleUniform);
|
||||
m_pSeries->setSingleHighlightColor(Qt::green);
|
||||
|
||||
m_pSeries->setMeshSmooth(false); // 设置网格是否平滑
|
||||
m_pSeries->setFlatShadingEnabled(false); // 启用或禁用平面着色
|
||||
}
|
||||
|
||||
void SurfaceDialog::InitScatter()
|
||||
|
26
Source/workspace/ParamSetting.ini
Normal file
26
Source/workspace/ParamSetting.ini
Normal file
@ -0,0 +1,26 @@
|
||||
[1]
|
||||
Name=111
|
||||
Des=111
|
||||
Type=String
|
||||
MaxValue=0
|
||||
MinValue=0
|
||||
Decimal=0
|
||||
Value=\x963f\x8fbe
|
||||
|
||||
[2]
|
||||
Name=222
|
||||
Des=222
|
||||
Type=Int
|
||||
MaxValue=100
|
||||
MinValue=2
|
||||
Decimal=0
|
||||
Value=59
|
||||
|
||||
[3]
|
||||
Name=333
|
||||
Des=333
|
||||
Type=Float
|
||||
MaxValue=11
|
||||
MinValue=5
|
||||
Decimal=3
|
||||
Value=3.65
|
@ -19,6 +19,7 @@
|
||||
<DockLeftArea Name="左侧区域">
|
||||
<Widget Plugin="SignalIndicatorLampUI" Name="信号指示灯"/>
|
||||
<Widget Plugin="TargetListWgt_Table" Name="目标上报信息"/>
|
||||
<Widget Plugin="ParamSetting" Name="参数设置"/>
|
||||
<DocTab Name="水平分页">
|
||||
<Widget Plugin="WaveCurveDialog" Name="波形曲线图"/>
|
||||
<Widget Plugin="SpeedCurveDialog" Name="距离速度曲线"/>
|
||||
|
Loading…
Reference in New Issue
Block a user