修改规范
This commit is contained in:
parent
5e4d8f943f
commit
cee020032e
|
|
@ -22,9 +22,7 @@ CountRateAnalysisView::CountRateAnalysisView(QWidget *parent) :
|
|||
{
|
||||
ui->setupUi(this);
|
||||
this->setViewType(PlotFrame);
|
||||
|
||||
InitUi();
|
||||
|
||||
}
|
||||
|
||||
CountRateAnalysisView::~CountRateAnalysisView()
|
||||
|
|
@ -98,7 +96,7 @@ QVector<ParticleInjectTime> CountRateAnalysisView::getParticleInjectTimeData(QSt
|
|||
{
|
||||
QVector<ParticleInjectTime> records;
|
||||
io::CSVReader<4> in(QStrToSysPath(path));
|
||||
in.read_header(io::ignore_extra_column, "板卡号", "通道号", "能量(KeV)", "时间计数");
|
||||
in.read_header(io::ignore_extra_column, QStringLiteral(u"板卡号").toStdString(), QStringLiteral(u"通道号").toStdString(), QStringLiteral(u"能量(KeV)").toStdString(), QStringLiteral(u"时间计数").toStdString());
|
||||
|
||||
int board, channel;
|
||||
double energy, time_count;
|
||||
|
|
@ -107,9 +105,9 @@ QVector<ParticleInjectTime> CountRateAnalysisView::getParticleInjectTimeData(QSt
|
|||
// 逐行读取
|
||||
while (in.read_row(board, channel, energy, time_count))
|
||||
{
|
||||
int detector = board + channel * 8;
|
||||
int detector = board * 4 + channel + 1;
|
||||
lineNumber++;
|
||||
if(detector >= 32)
|
||||
if(detector > 32)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
@ -120,8 +118,6 @@ QVector<ParticleInjectTime> CountRateAnalysisView::getParticleInjectTimeData(QSt
|
|||
records.append(rec);
|
||||
}
|
||||
return records;
|
||||
|
||||
return records;
|
||||
}
|
||||
|
||||
void CountRateAnalysisView::InitUi()
|
||||
|
|
@ -146,11 +142,5 @@ void CountRateAnalysisView::setupPlot()
|
|||
// 启用网格线
|
||||
plot->enableAxis(QwtPlot::xBottom);
|
||||
plot->enableAxis(QwtPlot::yLeft);
|
||||
|
||||
// 设置QWT图例
|
||||
// QwtLegend* legend = new QwtLegend();
|
||||
// legend->setDefaultItemMode(QwtLegendData::ReadOnly);
|
||||
// plot->insertLegend(legend, QwtPlot::RightLegend);
|
||||
|
||||
plot->SetXaxisDragScale(true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,13 +2,11 @@
|
|||
#define COUNTRATEANALYSISVIEW_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "qwt.h"
|
||||
#include "CustomQwtPlot.h"
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
#include "MeasureAnalysisView.h"
|
||||
|
||||
|
||||
class CustomQwtPlot;
|
||||
|
||||
namespace Ui {
|
||||
class CountRateAnalysisView;
|
||||
|
|
|
|||
|
|
@ -20,8 +20,22 @@
|
|||
#include <QFileDialog>
|
||||
#include <QStyleOptionButton>
|
||||
#include <GlobalDefine.h>
|
||||
#include <QObject>
|
||||
#include <QDebug>
|
||||
|
||||
class DeviceConfigViewModel: public QStandardItemModel
|
||||
{
|
||||
public:
|
||||
DeviceConfigViewModel(QObject *parent = nullptr) : QStandardItemModel(parent){}
|
||||
virtual Qt::ItemFlags flags(const QModelIndex &index) const {
|
||||
Qt::ItemFlags f = QStandardItemModel::flags(index);
|
||||
if ( index.column() == 0 ) {
|
||||
f = f & Qt::ItemIsUserCheckable;
|
||||
}
|
||||
return f;
|
||||
}
|
||||
};
|
||||
|
||||
DeviceConfigView::DeviceConfigView(QWidget *parent)
|
||||
: MeasureAnalysisView(parent)
|
||||
, m_tableView(nullptr)
|
||||
|
|
@ -53,7 +67,7 @@ void DeviceConfigView::initTableView()
|
|||
<< tr("上升时间") << tr("平顶时间") << tr("ICR 校正使能") << tr("CRZA 值")
|
||||
<< tr("ZA 使能值") << tr("操作");
|
||||
|
||||
m_model = new QStandardItemModel(this);
|
||||
m_model = new DeviceConfigViewModel(this);
|
||||
m_model->setColumnCount(headList.size());
|
||||
m_model->setHorizontalHeaderLabels(headList);
|
||||
m_model->setRowCount(32);
|
||||
|
|
@ -67,6 +81,7 @@ void DeviceConfigView::initTableView()
|
|||
int actionCol = headList.size() - 1;
|
||||
for (int row = 0; row < 32; ++row) {
|
||||
QStandardItem *item = new QStandardItem(QString());
|
||||
|
||||
item->setFlags(item->flags() & ~Qt::ItemIsEditable);
|
||||
m_model->setItem(row, actionCol, item);
|
||||
}
|
||||
|
|
@ -86,6 +101,8 @@ void DeviceConfigView::setupActionColumnButtons()
|
|||
{
|
||||
int actionCol = m_model->columnCount() - 1;
|
||||
for (int row = 0; row < m_model->rowCount(); ++row) {
|
||||
QModelIndex idx_0 = m_model->index(row, 0);
|
||||
|
||||
QModelIndex idx = m_model->index(row, actionCol);
|
||||
QPushButton *btn = new QPushButton(tr("应用"), m_tableView);
|
||||
btn->setProperty("row", row);
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ public:
|
|||
virtual void InitViewWorkspace(const QString& project_name) override final;
|
||||
virtual void SetAnalyzeDataFilename(const QMap<QString, QVariant>& data_files_set);
|
||||
|
||||
QList<int> getCheckedRows() const;
|
||||
|
||||
signals:
|
||||
|
||||
void dataChanged();
|
||||
|
|
|
|||
|
|
@ -53,10 +53,10 @@ void DeviceParameterConfig::setupUi()
|
|||
|
||||
// 右侧上部:文件名、保存按钮、备注说明
|
||||
QHBoxLayout *topLayout = new QHBoxLayout();
|
||||
QLabel *labelName = new QLabel(tr("配置命名:"), this);
|
||||
QLabel *labelName = new QLabel(QStringLiteral(u"配置命名:"), this);
|
||||
m_lineEditFileName = new QLineEdit(this);
|
||||
m_btnSave = new QPushButton(tr("保存到测量分析"), this);
|
||||
m_checkBoxSaveToDevice = new QCheckBox(tr("保存到设备参数配置管理"), this);
|
||||
m_btnSave = new QPushButton(QStringLiteral(u"保存到测量分析"), this);
|
||||
m_checkBoxSaveToDevice = new QCheckBox(QStringLiteral(u"保存到设备参数配置管理"), this);
|
||||
topLayout->addWidget(labelName);
|
||||
topLayout->addWidget(m_lineEditFileName, 1);
|
||||
topLayout->addWidget(m_btnSave);
|
||||
|
|
@ -64,7 +64,7 @@ void DeviceParameterConfig::setupUi()
|
|||
rightLayout->addLayout(topLayout);
|
||||
|
||||
QHBoxLayout *remarkLayout = new QHBoxLayout();
|
||||
QLabel *labelRemark = new QLabel(tr("备注说明:"), this);
|
||||
QLabel *labelRemark = new QLabel(QStringLiteral(u"备注说明:"), this);
|
||||
m_textEditRemark = new QTextEdit(this);
|
||||
m_textEditRemark->setMaximumHeight(80);
|
||||
remarkLayout->addWidget(labelRemark);
|
||||
|
|
@ -73,7 +73,7 @@ void DeviceParameterConfig::setupUi()
|
|||
|
||||
// 右侧中部:设置列按钮
|
||||
QHBoxLayout *buttonLayout = new QHBoxLayout();
|
||||
m_btnSetColumn = new QPushButton(tr("设置列"), this);
|
||||
m_btnSetColumn = new QPushButton(QStringLiteral(u"设置列"), this);
|
||||
buttonLayout->addWidget(m_btnSetColumn);
|
||||
buttonLayout->addStretch();
|
||||
rightLayout->addLayout(buttonLayout);
|
||||
|
|
@ -106,33 +106,33 @@ void DeviceParameterConfig::initColumnMapping()
|
|||
{
|
||||
// 与原 EquipmentParameterSettingManagement 完全相同的映射
|
||||
m_columnToJsonKey.clear();
|
||||
m_columnToJsonKey[tr("数据传输模式")] = "eTransferModel";
|
||||
m_columnToJsonKey[tr("硬件增益")] = "iDeviceGain";
|
||||
m_columnToJsonKey[tr("硬件增益选择索引")] = "iDeviceGainSelectIndex";
|
||||
m_columnToJsonKey[tr("软件增益")] = "iSoftGain";
|
||||
m_columnToJsonKey[tr("时间常数")] = "dConstTime";
|
||||
m_columnToJsonKey[tr("成形时间")] = "iFormTime";
|
||||
m_columnToJsonKey[tr("快通道触发阈值")] = "iFastChannelTrigerValue";
|
||||
m_columnToJsonKey[tr("多道分辨率")] = "iChannelNum";
|
||||
m_columnToJsonKey[tr("控制功能")] = "";
|
||||
m_columnToJsonKey[tr("幅度提前延迟")] = "";
|
||||
m_columnToJsonKey[tr("积分长度")] = "";
|
||||
m_columnToJsonKey[tr("dcfd缩放倍数")] = "";
|
||||
m_columnToJsonKey[tr("dcfd延迟")] = "";
|
||||
m_columnToJsonKey[tr("直流偏移")] = "iCurrentOffset";
|
||||
m_columnToJsonKey[tr("最大能量范围")] = "iMaxEnergy";
|
||||
m_columnToJsonKey[tr("Am 峰面积寻峰法的面积比例")] = "iAMPeakDiv";
|
||||
m_columnToJsonKey[tr("K40与 Am241的峰位校正系数")] = "iHVDelt";
|
||||
m_columnToJsonKey[tr("高压关断阈值")] = "iHVDelt";
|
||||
m_columnToJsonKey[tr("获取能谱周期")] = "iGetSpecturmPeirod";
|
||||
m_columnToJsonKey[tr("总测量时间")] = "iTotalMeasureTime";
|
||||
m_columnToJsonKey[tr("总测量次数")] = "iTotalMeasureCount";
|
||||
m_columnToJsonKey[tr("滤波参数")] = "iTrapeTopShitBit";
|
||||
m_columnToJsonKey[tr("上升时间")] = "iRiseTime";
|
||||
m_columnToJsonKey[tr("平顶时间")] = "iTopTime";
|
||||
m_columnToJsonKey[tr("ICR 校正使能")] = "bICRCorrect";
|
||||
m_columnToJsonKey[tr("CRZA 值")] = "iCRZAValue";
|
||||
m_columnToJsonKey[tr("ZA 使能值")] = "iZAEnable";
|
||||
m_columnToJsonKey[QStringLiteral(u"数据传输模式")] = "eTransferModel";
|
||||
m_columnToJsonKey[QStringLiteral(u"硬件增益")] = "iDeviceGain";
|
||||
m_columnToJsonKey[QStringLiteral(u"硬件增益选择索引")] = "iDeviceGainSelectIndex";
|
||||
m_columnToJsonKey[QStringLiteral(u"软件增益")] = "iSoftGain";
|
||||
m_columnToJsonKey[QStringLiteral(u"时间常数")] = "dConstTime";
|
||||
m_columnToJsonKey[QStringLiteral(u"成形时间")] = "iFormTime";
|
||||
m_columnToJsonKey[QStringLiteral(u"快通道触发阈值")] = "iFastChannelTrigerValue";
|
||||
m_columnToJsonKey[QStringLiteral(u"多道分辨率")] = "iChannelNum";
|
||||
m_columnToJsonKey[QStringLiteral(u"控制功能")] = "";
|
||||
m_columnToJsonKey[QStringLiteral(u"幅度提前延迟")] = "";
|
||||
m_columnToJsonKey[QStringLiteral(u"积分长度")] = "";
|
||||
m_columnToJsonKey[QStringLiteral(u"dcfd缩放倍数")] = "";
|
||||
m_columnToJsonKey[QStringLiteral(u"dcfd延迟")] = "";
|
||||
m_columnToJsonKey[QStringLiteral(u"直流偏移")] = "iCurrentOffset";
|
||||
m_columnToJsonKey[QStringLiteral(u"最大能量范围")] = "iMaxEnergy";
|
||||
m_columnToJsonKey[QStringLiteral(u"Am 峰面积寻峰法的面积比例")] = "iAMPeakDiv";
|
||||
m_columnToJsonKey[QStringLiteral(u"K40与 Am241的峰位校正系数")] = "iHVDelt";
|
||||
m_columnToJsonKey[QStringLiteral(u"高压关断阈值")] = "iHVDelt";
|
||||
m_columnToJsonKey[QStringLiteral(u"获取能谱周期")] = "iGetSpecturmPeirod";
|
||||
m_columnToJsonKey[QStringLiteral(u"总测量时间")] = "iTotalMeasureTime";
|
||||
m_columnToJsonKey[QStringLiteral(u"总测量次数")] = "iTotalMeasureCount";
|
||||
m_columnToJsonKey[QStringLiteral(u"滤波参数")] = "iTrapeTopShitBit";
|
||||
m_columnToJsonKey[QStringLiteral(u"上升时间")] = "iRiseTime";
|
||||
m_columnToJsonKey[QStringLiteral(u"平顶时间")] = "iTopTime";
|
||||
m_columnToJsonKey[QStringLiteral(u"ICR 校正使能")] = "bICRCorrect";
|
||||
m_columnToJsonKey[QStringLiteral(u"CRZA 值")] = "iCRZAValue";
|
||||
m_columnToJsonKey[QStringLiteral(u"ZA 使能值")] = "iZAEnable";
|
||||
}
|
||||
|
||||
void DeviceParameterConfig::setColumnMapping(const QHash<QString, QString> &mapping)
|
||||
|
|
@ -173,7 +173,7 @@ bool DeviceParameterConfig::loadConfig(const QString &filePath)
|
|||
bool DeviceParameterConfig::saveCurrentConfig()
|
||||
{
|
||||
if (m_currentFilePath.isEmpty()) {
|
||||
QMessageBox::warning(this, tr("错误"), tr("没有选中的配置文件"));
|
||||
QMessageBox::warning(this, QStringLiteral(u"错误"), QStringLiteral(u"没有选中的配置文件"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -255,14 +255,14 @@ void DeviceParameterConfig::onCreateNewConfigRequested(const QString &fileName)
|
|||
// 自动加载该配置(可选)
|
||||
loadConfig(filePath);
|
||||
} else {
|
||||
QMessageBox::warning(this, tr("错误"), tr("无法创建配置文件:%1").arg(filePath));
|
||||
QMessageBox::warning(this, QStringLiteral(u"错误"), QStringLiteral(u"无法创建配置文件:%1").arg(filePath));
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceParameterConfig::onSaveButtonClicked()
|
||||
{
|
||||
if (!saveCurrentConfig()) {
|
||||
QMessageBox::warning(this, tr("错误"), tr("保存配置文件失败"));
|
||||
QMessageBox::warning(this, QStringLiteral(u"错误"), QStringLiteral(u"保存配置文件失败"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,15 +31,15 @@ void DeviceParameterConfigList::setupUi()
|
|||
QVBoxLayout *mainLayout = new QVBoxLayout(this);
|
||||
mainLayout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
QLabel *ListWidgetName = new QLabel("设备参数配置列表");
|
||||
QLabel *ListWidgetName = new QLabel(QStringLiteral(u"设备参数配置列表"));
|
||||
mainLayout->addWidget(ListWidgetName);
|
||||
|
||||
m_listWidget = new QListWidget(this);
|
||||
mainLayout->addWidget(m_listWidget);
|
||||
|
||||
QHBoxLayout *btnLayout = new QHBoxLayout();
|
||||
m_btnAdd = new QPushButton(tr("添加"), this);
|
||||
m_btnDelete = new QPushButton(tr("删除"), this);
|
||||
m_btnAdd = new QPushButton(QStringLiteral(u"添加"), this);
|
||||
m_btnDelete = new QPushButton(QStringLiteral(u"删除"), this);
|
||||
btnLayout->addWidget(m_btnAdd);
|
||||
btnLayout->addWidget(m_btnDelete);
|
||||
btnLayout->addStretch();
|
||||
|
|
@ -115,8 +115,8 @@ void DeviceParameterConfigList::onItemClicked(QListWidgetItem *item)
|
|||
void DeviceParameterConfigList::onAddClicked()
|
||||
{
|
||||
bool ok;
|
||||
QString fileName = QInputDialog::getText(this, tr("新建配置"),
|
||||
tr("请输入配置文件名(无需后缀):"),
|
||||
QString fileName = QInputDialog::getText(this, QStringLiteral(u"新建配置"),
|
||||
QStringLiteral(u"请输入配置文件名(无需后缀):"),
|
||||
QLineEdit::Normal,
|
||||
QString("NewConfig_%1").arg(QDateTime::currentDateTime().toString("yyyyMMdd_hhmmss")),
|
||||
&ok);
|
||||
|
|
@ -127,7 +127,7 @@ void DeviceParameterConfigList::onAddClicked()
|
|||
|
||||
QString filePath = m_folderPath + "/" + fileName;
|
||||
if (QFile::exists(filePath)) {
|
||||
QMessageBox::warning(this, tr("错误"), tr("文件已存在,请使用其他名称。"));
|
||||
QMessageBox::warning(this, QStringLiteral(u"错误"), QStringLiteral(u"文件已存在,请使用其他名称。"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -139,15 +139,15 @@ void DeviceParameterConfigList::onDeleteClicked()
|
|||
{
|
||||
QListWidgetItem *currentItem = m_listWidget->currentItem();
|
||||
if (!currentItem) {
|
||||
QMessageBox::information(this, tr("提示"), tr("请先选择要删除的配置文件。"));
|
||||
QMessageBox::information(this, QStringLiteral(u"提示"), QStringLiteral(u"请先选择要删除的配置文件。"));
|
||||
return;
|
||||
}
|
||||
|
||||
QString fileName = currentItem->text();
|
||||
QString filePath = m_folderPath + "/" + fileName;
|
||||
|
||||
int ret = QMessageBox::question(this, tr("确认删除"),
|
||||
tr("确定要删除文件 \"%1\" 吗?").arg(fileName),
|
||||
int ret = QMessageBox::question(this, QStringLiteral(u"确认删除"),
|
||||
QStringLiteral(u"确定要删除文件 \"%1\" 吗?").arg(fileName),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
if (ret != QMessageBox::Yes) return;
|
||||
|
||||
|
|
@ -155,9 +155,9 @@ void DeviceParameterConfigList::onDeleteClicked()
|
|||
if (file.remove()) {
|
||||
delete currentItem;
|
||||
emit configDeleted(fileName);
|
||||
QMessageBox::information(this, tr("成功"), tr("文件已删除。"));
|
||||
QMessageBox::information(this, QStringLiteral(u"成功"), QStringLiteral(u"文件已删除。"));
|
||||
} else {
|
||||
QMessageBox::warning(this, tr("错误"), tr("无法删除文件:%1").arg(file.errorString()));
|
||||
QMessageBox::warning(this, QStringLiteral(u"错误"), QStringLiteral(u"无法删除文件:%1").arg(file.errorString()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,19 +22,19 @@ QWidget* DeviceParameterProxy::createEditor(QWidget *parent, const QStyleOptionV
|
|||
case 0: // 数据传输模式(枚举)
|
||||
{
|
||||
QComboBox *combo = new QComboBox(parent);
|
||||
combo->addItems(QStringList() << "谱线模式" << "波形模式" << "ADC模式" << "列表模式" << "α/β模式");
|
||||
combo->addItems(QStringList() << QStringLiteral(u"谱线模式") << QStringLiteral(u"波形模式") << QStringLiteral(u"ADC模式") << QStringLiteral(u"列表模式") << QStringLiteral(u"α/β模式"));
|
||||
return combo;
|
||||
}
|
||||
case 1: // 硬件增益(档位)
|
||||
{
|
||||
QComboBox *combo = new QComboBox(parent);
|
||||
combo->addItems(QStringList() << "1" << "2" << "4" << "8" << "16");
|
||||
combo->addItems(QStringList() << QStringLiteral(u"1") << QStringLiteral(u"2") << QStringLiteral(u"4") << QStringLiteral(u"8") << QStringLiteral(u"16"));
|
||||
return combo;
|
||||
}
|
||||
case 2: // 硬件增益选择索引
|
||||
{
|
||||
QComboBox *combo = new QComboBox(parent);
|
||||
combo->addItems(QStringList() << "1" << "2" << "3" << "4" << "5");
|
||||
combo->addItems(QStringList() << QStringLiteral(u"1") << QStringLiteral(u"2") << QStringLiteral(u"3") << QStringLiteral(u"4") << QStringLiteral(u"5"));
|
||||
return combo;
|
||||
}
|
||||
case 3: // 软件增益(32位无符号)
|
||||
|
|
@ -70,7 +70,7 @@ QWidget* DeviceParameterProxy::createEditor(QWidget *parent, const QStyleOptionV
|
|||
case 7: // 多道分辨率(2的幂)
|
||||
{
|
||||
QComboBox *combo = new QComboBox(parent);
|
||||
combo->addItems(QStringList() << "256" << "512" << "1024" << "2048" << "4096" << "8192" << "16384");
|
||||
combo->addItems(QStringList() << QStringLiteral(u"256") << QStringLiteral(u"512") << QStringLiteral(u"1024") << QStringLiteral(u"2048") << QStringLiteral(u"4096") << QStringLiteral(u"8192") << QStringLiteral(u"16384"));
|
||||
return combo;
|
||||
}
|
||||
case 8: // 控制功能(位掩码,暂用十进制输入)
|
||||
|
|
@ -174,7 +174,7 @@ QWidget* DeviceParameterProxy::createEditor(QWidget *parent, const QStyleOptionV
|
|||
case 24: // ICR校正使能(布尔)
|
||||
{
|
||||
QComboBox *combo = new QComboBox(parent);
|
||||
combo->addItems(QStringList() << "关闭" << "启用");
|
||||
combo->addItems(QStringList() << QStringLiteral(u"关闭") << QStringLiteral(u"启用"));
|
||||
return combo;
|
||||
}
|
||||
case 25: // CRZA值
|
||||
|
|
@ -355,7 +355,7 @@ bool DeviceParameterProxy::eventFilter(QObject *obj, QEvent *event)
|
|||
if (edit->validator()->validate(text, pos) != QValidator::Acceptable) {
|
||||
QString rangeHint = edit->property("rangeHint").toString();
|
||||
QPoint pos = edit->mapToGlobal(edit->rect().topRight());
|
||||
QToolTip::showText(pos, QString("取值范围: %1").arg(rangeHint), edit);
|
||||
QToolTip::showText(pos, QStringLiteral(u"取值范围: %1").arg(rangeHint), edit);
|
||||
// 延迟重新获得焦点
|
||||
QTimer::singleShot(0, edit, SLOT(setFocus()));
|
||||
return true; // 阻止焦点离开
|
||||
|
|
@ -371,7 +371,7 @@ bool DeviceParameterProxy::eventFilter(QObject *obj, QEvent *event)
|
|||
if (edit->validator()->validate(text, pos) != QValidator::Acceptable) {
|
||||
QString rangeHint = edit->property("rangeHint").toString();
|
||||
QPoint pos = edit->mapToGlobal(edit->rect().topRight());
|
||||
QToolTip::showText(pos, QString("取值范围: %1").arg(rangeHint), edit);
|
||||
QToolTip::showText(pos, QStringLiteral(u"取值范围: %1").arg(rangeHint), edit);
|
||||
return true; // 拦截回车,不提交
|
||||
} else {
|
||||
QToolTip::hideText();
|
||||
|
|
|
|||
|
|
@ -445,4 +445,5 @@ void ParticleCountPlotView::onActionEnergyScale()
|
|||
|
||||
void ParticleCountPlotView::onActionPlotConfigure()
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ void ParticleInjectTimeAnalysisView::SetAnalyzeDataFilename(const QMap<QString,
|
|||
if(!data_files_set.isEmpty())
|
||||
{
|
||||
io::CSVReader<4> in(QStrToSysPath(data_files_set.first().toString()));
|
||||
in.read_header(io::ignore_extra_column, "板卡号", "通道号", "能量(KeV)", "时间计数");
|
||||
in.read_header(io::ignore_extra_column, QStringLiteral(u"板卡号").toStdString(), QStringLiteral(u"通道号").toStdString(), QStringLiteral(u"能量(KeV)").toStdString(), QStringLiteral(u"时间计数").toStdString());
|
||||
|
||||
int board, channel;
|
||||
double energy, time_count;
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ void ConformityAnalysis::readCsv()
|
|||
qDebug()<<m_fileName;
|
||||
// 创建 CSVReader 对象,指定列数(5列)
|
||||
io::CSVReader<5> reader(QStrToSysPath(m_fileName));
|
||||
reader.read_header(io::ignore_extra_column, "事件ID","板卡号", "通道号", "能量(KeV)", "时间计数");
|
||||
reader.read_header(io::ignore_extra_column, QStringLiteral(u"事件ID").toStdString(),QStringLiteral(u"板卡号").toStdString(), QStringLiteral(u"通道号").toStdString(), QStringLiteral(u"能量(KeV)").toStdString(), QStringLiteral(u"时间计数").toStdString());
|
||||
// 逐行读取数据
|
||||
while (true)
|
||||
{
|
||||
|
|
@ -64,7 +64,6 @@ void ConformityAnalysis::readCsv()
|
|||
{
|
||||
break;
|
||||
}
|
||||
// qDebug()<< SpectrumData->eventId << " " << SpectrumData->board<<" "<<SpectrumData->channel;
|
||||
_spectrumDataList.push_back(SpectrumData);
|
||||
}
|
||||
}
|
||||
|
|
@ -106,12 +105,11 @@ void ConformityAnalysis::handleBoard()
|
|||
QMap<QString, int> ConformityAnalysis::statisticsFirstParticleQuantity()
|
||||
{
|
||||
QMap<QString, int> firstParticleCount;
|
||||
// 初始化所有板卡通道的计数为0
|
||||
for (int board = 1; board <= 8; ++board)
|
||||
{
|
||||
for (int channel = 1; channel <= 4; ++channel)
|
||||
{
|
||||
QString key = QString("widget_%1_%2").arg(board).arg(channel);
|
||||
QString key = QStringLiteral(u"widget_%1_%2").arg(board).arg(channel);
|
||||
firstParticleCount[key] = 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -128,7 +126,7 @@ QMap<QString, int> ConformityAnalysis::statisticsFirstParticleQuantity()
|
|||
if(firstParticle->eventId == eventId) continue;
|
||||
eventId = firstParticle->eventId;
|
||||
if (boardId >= 1 && boardId <= 8 && channelId >= 1 && channelId <= 4) {
|
||||
QString key = QString("widget_%1_%2").arg(boardId).arg(channelId);
|
||||
QString key = QStringLiteral(u"widget_%1_%2").arg(boardId).arg(channelId);
|
||||
firstParticleCount[key]++;
|
||||
}
|
||||
}
|
||||
|
|
@ -153,16 +151,6 @@ QVector<particleCoincidenceEvent*> ConformityAnalysis::handleBasicSubordinate(in
|
|||
eventId = data->eventId;
|
||||
}
|
||||
}
|
||||
// for (int i = 0; i < eventData.size(); i++)
|
||||
// {
|
||||
// F2t9Order::CoincidenceEvent EventData = eventData.at(i);
|
||||
// F2t9Order::SpectrumData data = EventData.events.at(0);
|
||||
// if (data.board_id == Board - 1&& data.channel_id == Channel - 1)
|
||||
// {
|
||||
// EventVector.push_back(EventData);
|
||||
// m_beginVector.push_back(data);
|
||||
// }
|
||||
// }
|
||||
return EventVector;
|
||||
}
|
||||
|
||||
|
|
@ -174,7 +162,7 @@ QMap<QString, int> ConformityAnalysis::handleSubordinate(QVector<particleCoincid
|
|||
{
|
||||
for (int channel = 1; channel <= 4; ++channel)
|
||||
{
|
||||
QString key = QString("widget_%1_%2").arg(board).arg(channel);
|
||||
QString key = QStringLiteral(u"widget_%1_%2").arg(board).arg(channel);
|
||||
data[key] = 0;
|
||||
for(auto dataSpectrum : eventData)
|
||||
{
|
||||
|
|
@ -188,30 +176,6 @@ QMap<QString, int> ConformityAnalysis::handleSubordinate(QVector<particleCoincid
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// for (int board = 1; board <= 8; ++board)
|
||||
// {
|
||||
// for (int channel = 1; channel <= 4; ++channel)
|
||||
// {
|
||||
// QString key = QString("widget_%1_%2").arg(board).arg(channel);
|
||||
// data[key] = 0;
|
||||
// for (int j = 0; j < eventData.size(); j++)
|
||||
// {
|
||||
// std::vector<F2t9Order::SpectrumData> dataVector = eventData.at(j).events;
|
||||
// for (int k = 0; k < dataVector.size(); k++)
|
||||
// {
|
||||
// F2t9Order::SpectrumData dataSpectrum = dataVector.at(k);
|
||||
// if (dataSpectrum.board_id == Board - 1 && dataSpectrum.channel_id == Channel - 1)
|
||||
// continue;
|
||||
// if (dataSpectrum.board_id == board - 1 && dataSpectrum.channel_id == channel - 1)
|
||||
// {
|
||||
// data[key]++;
|
||||
// m_secondVector.push_back(dataSpectrum);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
return data;
|
||||
}
|
||||
|
||||
|
|
@ -259,7 +223,7 @@ void ConformityAnalysis::setAllBoardData()
|
|||
{
|
||||
for (int channel = 1; channel <= 4; ++channel)
|
||||
{
|
||||
QString key = QString("widget_%1_%2").arg(board).arg(channel);
|
||||
QString key = QStringLiteral(u"widget_%1_%2").arg(board).arg(channel);
|
||||
qDebug()<<key;
|
||||
if ( m_FirstParticle.contains(key) ) {
|
||||
ui->widget->setInitWidgetData(board,channel,m_boardChannel[board - 1][channel-1],m_FirstParticle[key]);
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ void ParticleDataStatistics::InitUi()
|
|||
{
|
||||
for (int ch = 0;ch < MAX_CHANNEL;ch++)
|
||||
{
|
||||
QString name = QString("板卡%1(通道%2)").arg(bd + 1).arg(ch + 1);
|
||||
QString name = QStringLiteral(u"板卡%1(通道%2)").arg(bd + 1).arg(ch + 1);
|
||||
m_widgetMap[bd][ch]->setName(name);
|
||||
// 连接探测器点击信号到处理槽函数
|
||||
connect(m_widgetMap[bd][ch],SIGNAL(oneclicked(QString)),this,SLOT(_slotClickedBoard(QString)));
|
||||
|
|
@ -97,25 +97,25 @@ void ParticleDataStatistics::setWidgetData(int board, int channel, int countNum,
|
|||
//当板卡号和通道号都为-1时 设置为为点击状态
|
||||
if(board == -1 && channel == -1)
|
||||
{
|
||||
widget->setCountName("总计数");
|
||||
widget->setCountName(QStringLiteral(u"总计数"));
|
||||
widget->setNum(countNum);
|
||||
widget->setBeginSecond("初级粒子计数");
|
||||
widget->setBeginSecond(QStringLiteral(u"初级粒子计数"));
|
||||
widget->setBeginSecondNum(secondNum);
|
||||
return ;
|
||||
}
|
||||
//当板卡号和点击的板卡号相同时 设置为初级粒子
|
||||
if(board == m_bd && channel == m_ch)
|
||||
{
|
||||
widget->setCountName("初级粒子计数");
|
||||
widget->setCountName(QStringLiteral(u"初级粒子计数"));
|
||||
widget->setNum(secondNum);
|
||||
widget->setBeginSecond("总计数");
|
||||
widget->setBeginSecond(QStringLiteral(u"总计数"));
|
||||
widget->setBeginSecondNum(countNum);
|
||||
}
|
||||
else//否则为次级粒子
|
||||
{
|
||||
widget->setCountName("次级粒子计数");
|
||||
widget->setCountName(QStringLiteral(u"次级粒子计数"));
|
||||
widget->setNum(secondNum);
|
||||
widget->setBeginSecond("总计数");
|
||||
widget->setBeginSecond(QStringLiteral(u"总计数"));
|
||||
widget->setBeginSecondNum(countNum);
|
||||
}
|
||||
}
|
||||
|
|
@ -128,9 +128,9 @@ void ParticleDataStatistics::setInitWidgetData(int board, int channel, int count
|
|||
{
|
||||
return;
|
||||
}
|
||||
widget->setCountName("总计数");
|
||||
widget->setCountName(QStringLiteral(u"总计数"));
|
||||
widget->setNum(countNum);
|
||||
widget->setBeginSecond("初级粒子计数");
|
||||
widget->setBeginSecond(QStringLiteral(u"初级粒子计数"));
|
||||
widget->setBeginSecondNum(secondNum);
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user