优化寻峰结果处理界面
This commit is contained in:
parent
7b334164ba
commit
fcb94825ca
|
|
@ -585,14 +585,11 @@ bool AutoFindPeaksTask::processTask()
|
|||
out_file << channel_str << "," << addr_str << "," << left_addr_str << "," << lright_addr_str << "," << width_str << "\n";
|
||||
|
||||
for (auto it = this->_data_files_set.begin(); it != this->_data_files_set.end(); ++it) {
|
||||
const QString& debug = QStringLiteral(u"自动寻峰%1").arg(it.key());
|
||||
LOG_DEBUG(debug);
|
||||
|
||||
std::string channel = it.key().toStdString();
|
||||
arma::mat data;
|
||||
const std::string data_filename = QStrToSysPath(it.value().toString());
|
||||
if (!data.load(data_filename, arma::csv_ascii)) {
|
||||
QString error = QString(QStringLiteral(u"%1自动寻峰数据文件%2加载异常!")).arg(it.key()).arg(it.value().toString());
|
||||
QString error = QString(QStringLiteral(u"%1自动寻峰数据加载异常!")).arg(it.key());
|
||||
LOG_WARN(error);
|
||||
continue;
|
||||
}
|
||||
|
|
@ -610,6 +607,9 @@ bool AutoFindPeaksTask::processTask()
|
|||
const QString& error = QStringLiteral(u"%1自动寻峰异常!").arg(it.key());
|
||||
LOG_WARN(error);
|
||||
}
|
||||
const QString& info = QStringLiteral(u"%1自动寻峰完成").arg(it.key());
|
||||
LOG_INFO(info);
|
||||
|
||||
}
|
||||
|
||||
const QString& project_name = GetProjectName();
|
||||
|
|
@ -619,6 +619,7 @@ bool AutoFindPeaksTask::processTask()
|
|||
} else {
|
||||
project_model->SetAnalysisCustomData(this->_analysis_type, QString("AutoFindPeaksResult"), result_filename);
|
||||
}
|
||||
|
||||
const QString& info = QStringLiteral(u"自动寻峰完成");
|
||||
LOG_INFO(info);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -171,8 +171,8 @@ void MainWindow::initAction()
|
|||
}
|
||||
}
|
||||
};
|
||||
connect(ui->action_new_measurement_analysis, &QAction::triggered, this, new_measurement_analysis_handler);
|
||||
connect(ui->action_open_measurement_analysis, &QAction::triggered, this, [this](){
|
||||
connect(ui->action_new_measurement_analysis, &QAction::triggered, new_measurement_analysis_handler);
|
||||
connect(ui->action_open_measurement_analysis, &QAction::triggered, [this](){
|
||||
const QString& filename = QFileDialog::getOpenFileName(this, QStringLiteral(u"选择测量分析项目文件"), QString(), QStringLiteral(u"测量分析项目 (*.msproject)"));
|
||||
if (filename.isEmpty()) {
|
||||
return;
|
||||
|
|
@ -188,7 +188,7 @@ void MainWindow::initAction()
|
|||
}
|
||||
|
||||
});
|
||||
connect(ui->action_save_measurement_analysis, &QAction::triggered, this, [](){
|
||||
connect(ui->action_save_measurement_analysis, &QAction::triggered, [](){
|
||||
MeasureAnalysisProjectModel* project_model = ProjectList::Instance()->GetCurrentProjectModel();
|
||||
if (project_model) {
|
||||
const QString& project_name = project_model->GetProjectName();
|
||||
|
|
@ -201,7 +201,7 @@ void MainWindow::initAction()
|
|||
}
|
||||
}
|
||||
});
|
||||
connect(ui->action_close_measurement_analysis, &QAction::triggered, this, [this](){
|
||||
connect(ui->action_close_measurement_analysis, &QAction::triggered, [this](){
|
||||
MeasureAnalysisProjectModel* project_model = ProjectList::Instance()->GetCurrentProjectModel();
|
||||
if (project_model) {
|
||||
const QString& project_name = project_model->GetProjectName();
|
||||
|
|
@ -219,7 +219,7 @@ void MainWindow::initAction()
|
|||
|
||||
});
|
||||
connect(ui->action_manage_measurement_analysis, &QAction::triggered, this->_action_central_dock_widget, &QAction::triggered);
|
||||
connect(ui->action_device_config_mrg, &QAction::triggered, this, []() {
|
||||
connect(ui->action_device_config_mrg, &QAction::triggered, []() {
|
||||
QDialog device_cfg_mrg_dlg;
|
||||
device_cfg_mrg_dlg.setObjectName("MeasureDeviceParamsCfgFormDlg");
|
||||
device_cfg_mrg_dlg.setWindowTitle(QStringLiteral(u"测量设备参数配置管理"));
|
||||
|
|
@ -230,7 +230,7 @@ void MainWindow::initAction()
|
|||
device_cfg_mrg_dlg.setLayout(hlayout);
|
||||
device_cfg_mrg_dlg.exec();
|
||||
});
|
||||
connect(ui->action_enery_scale_mrg, &QAction::triggered, this, []() {
|
||||
connect(ui->action_enery_scale_mrg, &QAction::triggered, []() {
|
||||
QDialog enery_scale_mrg_dlg;
|
||||
enery_scale_mrg_dlg.setObjectName("EneryScaleFormDlg");
|
||||
enery_scale_mrg_dlg.setWindowTitle(QStringLiteral(u"能量刻度管理"));
|
||||
|
|
@ -241,7 +241,7 @@ void MainWindow::initAction()
|
|||
enery_scale_mrg_dlg.setLayout(hlayout);
|
||||
enery_scale_mrg_dlg.exec();
|
||||
});
|
||||
connect(ui->action_about_info, &QAction::triggered, this, []() {
|
||||
connect(ui->action_about_info, &QAction::triggered, []() {
|
||||
AboutDlg about_dlg;
|
||||
about_dlg.exec();
|
||||
});
|
||||
|
|
@ -262,11 +262,8 @@ void MainWindow::initAction()
|
|||
}
|
||||
if ( !view_exist ) {
|
||||
ads::CDockWidget* dock_widget = new ads::CDockWidget(view->GetViewName());
|
||||
auto central_area = _dock_manager->centralWidget()->dockAreaWidget();
|
||||
_dock_manager->addDockWidget(ads::DockWidgetArea::CenterDockWidgetArea, dock_widget, central_area);
|
||||
|
||||
dock_widget->setWidget(view);
|
||||
dock_widget->setMinimumSizeHintMode(ads::CDockWidget::MinimumSizeHintFromContentMinimumSize);
|
||||
dock_widget->setMinimumSizeHintMode(ads::CDockWidget::MinimumSizeHintFromDockWidget);
|
||||
if (view->IsDeleteOnClose()) {
|
||||
dock_widget->setFeatures(dock_widget->features() | ads::CDockWidget::DockWidgetDeleteOnClose);
|
||||
} else {
|
||||
|
|
@ -283,6 +280,8 @@ void MainWindow::initAction()
|
|||
if ( view->GetViewType() == MeasureAnalysisView::PlotFrame ) {
|
||||
_menu_view_analysis_view_list->addAction(dock_widget->toggleViewAction());
|
||||
}
|
||||
auto central_area = _dock_manager->centralWidget()->dockAreaWidget();
|
||||
_dock_manager->addDockWidget(ads::DockWidgetArea::CenterDockWidgetArea, dock_widget, central_area);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#include <QComboBox>
|
||||
#include <QTableWidget>
|
||||
#include <QSpinBox>
|
||||
#include <fstream>
|
||||
|
||||
MeasureAnalysisParticleCountPlotView::MeasureAnalysisParticleCountPlotView(QWidget* parent)
|
||||
: MeasureAnalysisView { parent }
|
||||
|
|
@ -85,7 +86,7 @@ void MeasureAnalysisParticleCountPlotView::SetAnalyzeDataFilename(const QMap<QSt
|
|||
void MeasureAnalysisParticleCountPlotView::setupMenu()
|
||||
{
|
||||
this->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(this, &MeasureAnalysisParticleCountPlotView::customContextMenuRequested, this, [this](const QPoint &pos){
|
||||
connect(this, &MeasureAnalysisParticleCountPlotView::customContextMenuRequested, [this](const QPoint &pos){
|
||||
this->_menu->exec(this->mapToGlobal(pos));
|
||||
});
|
||||
QAction* action_set_curve_show = this->_menu->addAction(QStringLiteral(u"选择曲线"));
|
||||
|
|
@ -161,9 +162,75 @@ void MeasureAnalysisParticleCountPlotView::loadDataFromFile(const QString& data_
|
|||
_plot->AddCurve(curve);
|
||||
}
|
||||
|
||||
void MeasureAnalysisParticleCountPlotView::loadPeaksResultToTable(QTableWidget *peaks_result_table)
|
||||
{
|
||||
if (!peaks_result_table)
|
||||
return;
|
||||
|
||||
auto row_count = peaks_result_table->rowCount();
|
||||
for (int i = 0; i < row_count - 1; i++) {
|
||||
peaks_result_table->removeRow(i);
|
||||
}
|
||||
|
||||
const QString& channel_col_name = QString(QStringLiteral(u"通道"));
|
||||
const QString& peak_pos_col_name = QString(QStringLiteral(u"峰位"));
|
||||
const QString& left_bound_col_name = QString(QStringLiteral(u"左边界"));
|
||||
const QString& right_bound_col_name = QString(QStringLiteral(u"右边界"));
|
||||
const QString& peak_width_col_name = QString(QStringLiteral(u"峰宽"));
|
||||
const QString& peaks_result_filename = QDir(this->_workspace).filePath("AutoFindPeaksResult.csv");
|
||||
io::CSVReader<
|
||||
5,
|
||||
io::trim_chars<' ', '\t'>,
|
||||
io::double_quote_escape<',', '"'>,
|
||||
io::throw_on_overflow,
|
||||
io::empty_line_comment
|
||||
> reader(QStrToSysPath(peaks_result_filename));
|
||||
reader.read_header(io::ignore_extra_column,
|
||||
channel_col_name.toStdString(),
|
||||
peak_pos_col_name.toStdString(),
|
||||
left_bound_col_name.toStdString(),
|
||||
right_bound_col_name.toStdString(),
|
||||
peak_width_col_name.toStdString()
|
||||
);
|
||||
std::string ch_name; int peak_pos; int left_bound, right_bound, peak_width;
|
||||
while (reader.read_row(ch_name, peak_pos, left_bound, right_bound, peak_width))
|
||||
{
|
||||
if (!ch_name.empty()) {
|
||||
int row = peaks_result_table->rowCount();
|
||||
peaks_result_table->insertRow(row);
|
||||
peaks_result_table->setItem(row, 0, new QTableWidgetItem(QString::fromStdString(ch_name)));
|
||||
peaks_result_table->item(row, 0)->setCheckState(Qt::Unchecked);
|
||||
peaks_result_table->setItem(row, 1, new QTableWidgetItem(QString::number(peak_pos)));
|
||||
peaks_result_table->setItem(row, 2, new QTableWidgetItem(QString::number(left_bound)));
|
||||
peaks_result_table->setItem(row, 3, new QTableWidgetItem(QString::number(right_bound)));
|
||||
peaks_result_table->setItem(row, 4, new QTableWidgetItem(QString::number(peak_width)));
|
||||
QTableWidgetItem* item = new QTableWidgetItem;
|
||||
peaks_result_table->setItem(row, 5, item);
|
||||
QPushButton* btn_remove_row = new QPushButton(QStringLiteral(u"删除"));
|
||||
connect(btn_remove_row, &QPushButton::clicked, [peaks_result_table, item, btn_remove_row](){
|
||||
int remove_row = item->row();
|
||||
peaks_result_table->removeRow(remove_row);
|
||||
btn_remove_row->deleteLater();
|
||||
});
|
||||
peaks_result_table->setCellWidget(row, 5, btn_remove_row);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MeasureAnalysisParticleCountPlotView::onAutoFindPeaksFinished(const QString &project_name)
|
||||
{
|
||||
Q_UNUSED(project_name);
|
||||
if (_find_peaks_result_dlg) {
|
||||
for (const auto& child_obj : _find_peaks_result_dlg->children()) {
|
||||
if ( "peaks_result_table" == child_obj->objectName() ) {
|
||||
QTableWidget* table = qobject_cast<QTableWidget*>(child_obj);
|
||||
if ( table ) {
|
||||
loadPeaksResultToTable(table);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
onFindPeaksResult();
|
||||
}
|
||||
|
||||
|
|
@ -171,8 +238,9 @@ void MeasureAnalysisParticleCountPlotView::onCurveShowSetting()
|
|||
{
|
||||
if (!_curve_show_setting_dlg) {
|
||||
_curve_show_setting_dlg = new QDialog(this, Qt::Dialog | Qt::WindowCloseButtonHint);
|
||||
_curve_show_setting_dlg->setWindowTitle(QString(QStringLiteral(u"选择%1曲线显示").arg(this->_plot->title().text())));
|
||||
_curve_show_setting_dlg->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
_curve_show_setting_dlg->setSizeGripEnabled(false);
|
||||
_curve_show_setting_dlg->setWindowTitle(QString(QStringLiteral(u"选择%1曲线显示").arg(this->_plot->title().text())));
|
||||
_curve_show_setting_dlg->setWindowModality(Qt::WindowModal);
|
||||
_curve_show_setting_dlg->setModal(false);
|
||||
QVBoxLayout* layout = new QVBoxLayout(_curve_show_setting_dlg);
|
||||
|
|
@ -186,7 +254,7 @@ void MeasureAnalysisParticleCountPlotView::onCurveShowSetting()
|
|||
QCheckBox* check_box = new QCheckBox(curve->title().text());
|
||||
check_box->setChecked(curve->isVisible());
|
||||
checkbox_column_layout->addWidget(check_box);
|
||||
connect(check_box, &QCheckBox::stateChanged, this, [curve](int state){
|
||||
connect(check_box, &QCheckBox::stateChanged, [curve](int state){
|
||||
curve->setVisible(state == Qt::Checked);
|
||||
curve->plot()->replot();
|
||||
});
|
||||
|
|
@ -208,7 +276,7 @@ void MeasureAnalysisParticleCountPlotView::onCurveShowSetting()
|
|||
};
|
||||
QHBoxLayout* button_layout = new QHBoxLayout();
|
||||
QPushButton* btn_all_select = new QPushButton(QString(QStringLiteral(u"全选")));
|
||||
connect(btn_all_select, &QPushButton::clicked, this, [this, curveCheckboxUpdate](){
|
||||
connect(btn_all_select, &QPushButton::clicked, [this, curveCheckboxUpdate](){
|
||||
for (QwtPlotCurve* curve : this->_plot->GetCurveList()) {
|
||||
curve->setVisible(true);
|
||||
}
|
||||
|
|
@ -217,7 +285,7 @@ void MeasureAnalysisParticleCountPlotView::onCurveShowSetting()
|
|||
});
|
||||
button_layout->addWidget(btn_all_select);
|
||||
QPushButton* btn_reserve_select = new QPushButton(QString(QStringLiteral(u"反选")));
|
||||
connect(btn_reserve_select, &QPushButton::clicked, this, [this, curveCheckboxUpdate](){
|
||||
connect(btn_reserve_select, &QPushButton::clicked, [this, curveCheckboxUpdate](){
|
||||
for (QwtPlotCurve* curve : this->_plot->GetCurveList()) {
|
||||
curve->setVisible(!curve->isVisible());
|
||||
}
|
||||
|
|
@ -235,66 +303,47 @@ void MeasureAnalysisParticleCountPlotView::onCurveShowSetting()
|
|||
void MeasureAnalysisParticleCountPlotView::onFindPeaksResult()
|
||||
{
|
||||
if (!_find_peaks_result_dlg) {
|
||||
const QString& peaks_result_filename = QDir(this->_workspace).filePath("AutoFindPeaksResult.csv");
|
||||
|
||||
_find_peaks_result_dlg = new QDialog(this, Qt::Dialog | Qt::WindowCloseButtonHint);
|
||||
_find_peaks_result_dlg->setWindowTitle(QString(QStringLiteral(u"寻峰结果")));
|
||||
_find_peaks_result_dlg->setWindowModality(Qt::WindowModal);
|
||||
_find_peaks_result_dlg->setModal(false);
|
||||
|
||||
QPushButton* btn_all_select = new QPushButton(QString(QStringLiteral(u"全选")));
|
||||
QPushButton* btn_reserve_select = new QPushButton(QString(QStringLiteral(u"反选")));
|
||||
QLabel* filter_channel_label = new QLabel(QString(QStringLiteral(u"筛选通道:")));
|
||||
QComboBox* filter_channel_combo_box = new QComboBox();
|
||||
filter_channel_combo_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||
filter_channel_combo_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
filter_channel_combo_box->addItem(QString(QStringLiteral(u"所有通道")));
|
||||
for (QwtPlotCurve* curve : this->_plot->GetCurveList()) {
|
||||
filter_channel_combo_box->addItem(curve->title().text());
|
||||
}
|
||||
QHBoxLayout* filter_channel_layout = new QHBoxLayout();
|
||||
filter_channel_layout->addWidget(filter_channel_label);
|
||||
filter_channel_layout->addWidget(filter_channel_combo_box);
|
||||
// filter_channel_layout->addStretch();
|
||||
QPushButton* btn_save = new QPushButton(QString(QStringLiteral(u"保存")));
|
||||
QHBoxLayout* top_layout = new QHBoxLayout();
|
||||
top_layout->addWidget(btn_all_select);
|
||||
top_layout->addWidget(btn_reserve_select);
|
||||
top_layout->addSpacing(10);
|
||||
top_layout->addWidget(filter_channel_label);
|
||||
top_layout->addWidget(filter_channel_combo_box);
|
||||
top_layout->addSpacing(10);
|
||||
top_layout->addWidget(btn_save);
|
||||
|
||||
const QString& channel_col_name = QString(QStringLiteral(u"通道"));
|
||||
const QString& peak_pos_col_name = QString(QStringLiteral(u"峰位"));
|
||||
const QString& left_bound_col_name = QString(QStringLiteral(u"左边界"));
|
||||
const QString& right_bound_col_name = QString(QStringLiteral(u"右边界"));
|
||||
const QString& peak_width_col_name = QString(QStringLiteral(u"峰宽"));
|
||||
const QString& operation_col_name = QString(QStringLiteral(u"操作"));
|
||||
QTableWidget* peaks_result_table = new QTableWidget();
|
||||
peaks_result_table->setColumnCount(5);
|
||||
peaks_result_table->setObjectName("peaks_result_table");
|
||||
peaks_result_table->setColumnCount(6);
|
||||
peaks_result_table->setHorizontalHeaderLabels({
|
||||
channel_col_name, peak_pos_col_name, left_bound_col_name, right_bound_col_name, peak_width_col_name
|
||||
channel_col_name, peak_pos_col_name, left_bound_col_name, right_bound_col_name, peak_width_col_name, operation_col_name
|
||||
});
|
||||
peaks_result_table->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
peaks_result_table->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
// 使用csv.h从peaks_result_filename CSV文件读取数据
|
||||
io::CSVReader<
|
||||
5,
|
||||
io::trim_chars<' ', '\t'>,
|
||||
io::double_quote_escape<',', '"'>,
|
||||
io::throw_on_overflow,
|
||||
io::empty_line_comment
|
||||
> reader(QStrToSysPath(peaks_result_filename));
|
||||
reader.read_header(io::ignore_extra_column,
|
||||
channel_col_name.toStdString(),
|
||||
peak_pos_col_name.toStdString(),
|
||||
left_bound_col_name.toStdString(),
|
||||
right_bound_col_name.toStdString(),
|
||||
peak_width_col_name.toStdString()
|
||||
);
|
||||
std::string ch_name; int peak_pos; int left_bound, right_bound, peak_width;
|
||||
while (reader.read_row(ch_name, peak_pos, left_bound, right_bound, peak_width))
|
||||
{
|
||||
if (!ch_name.empty()) {
|
||||
int row = peaks_result_table->rowCount();
|
||||
peaks_result_table->insertRow(row);
|
||||
peaks_result_table->setItem(row, 0, new QTableWidgetItem(QString::fromStdString(ch_name)));
|
||||
peaks_result_table->setItem(row, 1, new QTableWidgetItem(QString::number(peak_pos)));
|
||||
peaks_result_table->setItem(row, 2, new QTableWidgetItem(QString::number(left_bound)));
|
||||
peaks_result_table->setItem(row, 3, new QTableWidgetItem(QString::number(right_bound)));
|
||||
peaks_result_table->setItem(row, 4, new QTableWidgetItem(QString::number(peak_width)));
|
||||
}
|
||||
}
|
||||
connect(filter_channel_combo_box, &QComboBox::currentTextChanged, this, [this, peaks_result_table](const QString& text){
|
||||
this->loadPeaksResultToTable(peaks_result_table);
|
||||
|
||||
connect(filter_channel_combo_box, &QComboBox::currentTextChanged, [this, peaks_result_table](const QString& text){
|
||||
auto row_count = peaks_result_table->rowCount();
|
||||
if (text == QString(QStringLiteral(u"所有通道"))) {
|
||||
for (int i = 0; i < row_count - 1; i++) {
|
||||
|
|
@ -308,9 +357,56 @@ void MeasureAnalysisParticleCountPlotView::onFindPeaksResult()
|
|||
}
|
||||
}
|
||||
});
|
||||
connect(btn_all_select, &QPushButton::clicked, [peaks_result_table](){
|
||||
auto row_count = peaks_result_table->rowCount();
|
||||
for (int i = 0; i < row_count - 1; i++) {
|
||||
if (peaks_result_table->isRowHidden(i)) {
|
||||
continue;
|
||||
}
|
||||
auto item = peaks_result_table->item(i, 0);
|
||||
if (item) {
|
||||
item->setCheckState(Qt::Checked);
|
||||
}
|
||||
}
|
||||
});
|
||||
connect(btn_reserve_select, &QPushButton::clicked, [peaks_result_table](){
|
||||
auto row_count = peaks_result_table->rowCount();
|
||||
for (int i = 0; i < row_count - 1; i++) {
|
||||
if (peaks_result_table->isRowHidden(i)) {
|
||||
continue;
|
||||
}
|
||||
auto item = peaks_result_table->item(i, 0);
|
||||
if (item) {
|
||||
Qt::CheckState check_state = (item->checkState() == Qt::Checked) ? Qt::Unchecked : Qt::Checked;
|
||||
item->setCheckState(check_state);
|
||||
}
|
||||
}
|
||||
});
|
||||
connect(btn_save, &QPushButton::clicked, [peaks_result_table, this](){
|
||||
const QString& peaks_result_filename = QDir(this->_workspace).filePath("AutoFindPeaksResult.csv");
|
||||
std::ofstream out_file(QStrToSysPath(peaks_result_filename));
|
||||
|
||||
std::string channel_str = QString(QStringLiteral(u"通道")).toStdString();
|
||||
std::string addr_str = QString(QStringLiteral(u"峰位")).toStdString();
|
||||
std::string left_addr_str = QString(QStringLiteral(u"左边界")).toStdString();
|
||||
std::string lright_addr_str = QString(QStringLiteral(u"右边界")).toStdString();
|
||||
std::string width_str = QString(QStringLiteral(u"峰宽")).toStdString();
|
||||
out_file << channel_str << "," << addr_str << "," << left_addr_str << "," << lright_addr_str << "," << width_str << "\n";
|
||||
|
||||
auto row_count = peaks_result_table->rowCount();
|
||||
for (int i = 0; i < row_count - 1; i++) {
|
||||
std::string channel = peaks_result_table->item(i, 0)->text().toStdString();
|
||||
int peak_pos = peaks_result_table->item(i, 1)->text().toInt();
|
||||
int left_bound = peaks_result_table->item(i, 2)->text().toInt();
|
||||
int right_bound = peaks_result_table->item(i, 3)->text().toInt();
|
||||
int peak_width = peaks_result_table->item(i, 4)->text().toInt();
|
||||
out_file << channel << "," << peak_pos << "," << left_bound << "," << right_bound << "," << peak_width << "\n";
|
||||
}
|
||||
LOG_INFO(QStringLiteral(u"保存峰信息完成."));
|
||||
});
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(_find_peaks_result_dlg);
|
||||
layout->addLayout(filter_channel_layout);
|
||||
layout->addLayout(top_layout);
|
||||
layout->addWidget(peaks_result_table);
|
||||
}
|
||||
_find_peaks_result_dlg->show();
|
||||
|
|
@ -319,26 +415,31 @@ void MeasureAnalysisParticleCountPlotView::onFindPeaksResult()
|
|||
void MeasureAnalysisParticleCountPlotView::onAutoFindPeaks()
|
||||
{
|
||||
QDialog set_find_peak_step_win_width_dlg(this, Qt::Dialog | Qt::WindowCloseButtonHint);
|
||||
set_find_peak_step_win_width_dlg.setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
set_find_peak_step_win_width_dlg.setFixedSize(300, 50);
|
||||
set_find_peak_step_win_width_dlg.setSizeGripEnabled(false);
|
||||
set_find_peak_step_win_width_dlg.setWindowTitle(QString(QStringLiteral(u"设置自动寻峰步宽")));
|
||||
|
||||
QLabel* set_step_width_label = new QLabel(QString(QStringLiteral(u"自动寻峰步宽:")));
|
||||
QSpinBox * spinbox_set_step_width = new QSpinBox();
|
||||
spinbox_set_step_width->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||
QVBoxLayout* layout_input = new QVBoxLayout();
|
||||
spinbox_set_step_width->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
spinbox_set_step_width->setRange(7, 65535);
|
||||
QHBoxLayout* layout_input = new QHBoxLayout();
|
||||
layout_input->addWidget(set_step_width_label);
|
||||
layout_input->addWidget(spinbox_set_step_width);
|
||||
|
||||
QPushButton* btn_ok = new QPushButton(QStringLiteral(u"确认"));
|
||||
connect(btn_ok, &QPushButton::clicked, &set_find_peak_step_win_width_dlg, &QDialog::accept);
|
||||
QPushButton* btn_cancel = new QPushButton(QStringLiteral(u"取消"));
|
||||
connect(btn_ok, &QPushButton::clicked, &set_find_peak_step_win_width_dlg, &QDialog::reject);
|
||||
connect(btn_cancel, &QPushButton::clicked, &set_find_peak_step_win_width_dlg, &QDialog::reject);
|
||||
QHBoxLayout* layout_btns = new QHBoxLayout();
|
||||
layout_btns->addStretch();
|
||||
layout_btns->addWidget(btn_ok);
|
||||
layout_btns->addWidget(btn_cancel);
|
||||
|
||||
QHBoxLayout* layout = new QHBoxLayout(&set_find_peak_step_win_width_dlg);
|
||||
QVBoxLayout* layout = new QVBoxLayout(&set_find_peak_step_win_width_dlg);
|
||||
layout->addLayout(layout_input);
|
||||
layout->addStretch();
|
||||
layout->addLayout(layout_btns);
|
||||
|
||||
if (QDialog::Accepted == set_find_peak_step_win_width_dlg.exec() ) {
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
class QDialog;
|
||||
class QMenu;
|
||||
class CustomQwtPlot;
|
||||
class QTableWidget;
|
||||
|
||||
class MeasureAnalysisParticleCountPlotView : public MeasureAnalysisView
|
||||
{
|
||||
|
|
@ -22,6 +23,8 @@ private:
|
|||
void setupMenu();
|
||||
void setupPlot();
|
||||
void loadDataFromFile(const QString &data_name, const QString& filename);
|
||||
void loadPeaksResultToTable(QTableWidget* peaks_result_table);
|
||||
|
||||
private slots:
|
||||
void onAutoFindPeaksFinished(const QString& project_name);
|
||||
private slots:
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ void NewMeasureAnalysisDlg::initialization()
|
|||
ui->lineEdit_name->setValidator(validator);
|
||||
|
||||
ui->rbtn_sample_spec->setChecked(true);
|
||||
connect(ui->rbtn_sample_spec, &QRadioButton::toggled, this, [this](bool checked){
|
||||
connect(ui->rbtn_sample_spec, &QRadioButton::toggled, [this](bool checked){
|
||||
ui->label_is_std_source->setEnabled(checked);
|
||||
ui->checkBox_is_std_source->setEnabled(checked);
|
||||
});
|
||||
|
|
@ -37,7 +37,7 @@ void NewMeasureAnalysisDlg::initialization()
|
|||
ui->label_filename->setEnabled(false);
|
||||
ui->lineEdit_filename->setEnabled(false);
|
||||
ui->btn_filename->setEnabled(false);
|
||||
connect(ui->checkBox_file_data, &QCheckBox::toggled, this, [this](bool checked){
|
||||
connect(ui->checkBox_file_data, &QCheckBox::toggled, [this](bool checked){
|
||||
ui->label_filename->setEnabled(checked);
|
||||
ui->lineEdit_filename->setEnabled(checked);
|
||||
ui->btn_filename->setEnabled(checked);
|
||||
|
|
@ -46,7 +46,7 @@ void NewMeasureAnalysisDlg::initialization()
|
|||
ui->spinBox_conform_time->setEnabled(!checked);
|
||||
});
|
||||
|
||||
connect(ui->btn_filename, &QPushButton::clicked, this, [this](){
|
||||
connect(ui->btn_filename, &QPushButton::clicked, [this](){
|
||||
const QString& filename = QFileDialog::getOpenFileName(this, QStringLiteral(u"选择粒子数据文件"), QString(), QStringLiteral(u"CSV (*.csv);;GVF (*.gvf)"));
|
||||
if (filename.isEmpty()) {
|
||||
return;
|
||||
|
|
@ -79,7 +79,7 @@ void NewMeasureAnalysisDlg::initialization()
|
|||
};
|
||||
|
||||
ui->btn_previous_step->setEnabled(false);
|
||||
connect(ui->btn_previous_step, &QPushButton::clicked, this, [turnStackPageBtnState, this](){
|
||||
connect(ui->btn_previous_step, &QPushButton::clicked, [turnStackPageBtnState, this](){
|
||||
int current_stack_index = ui->stackedWidget->currentIndex();
|
||||
if ( current_stack_index > 0 ) {
|
||||
--current_stack_index;
|
||||
|
|
@ -89,7 +89,7 @@ void NewMeasureAnalysisDlg::initialization()
|
|||
});
|
||||
|
||||
ui->btn_next_step->setEnabled(true);
|
||||
connect(ui->btn_next_step, &QPushButton::clicked, this, [turnStackPageBtnState, this](){
|
||||
connect(ui->btn_next_step, &QPushButton::clicked, [turnStackPageBtnState, this](){
|
||||
int last_stack_index = ui->stackedWidget->count() - 1;
|
||||
int current_stack_index = ui->stackedWidget->currentIndex();
|
||||
if ( current_stack_index < last_stack_index ) {
|
||||
|
|
|
|||
|
|
@ -346,7 +346,7 @@ void VirtualTableModel::loadBlock(int blockIndex, bool priority)
|
|||
QFuture<QList<QList<QVariant>>> future = QtConcurrent::run(QThreadPool::globalInstance(), loadFunction);
|
||||
QFutureWatcher<QList<QList<QVariant>>>* watcher = new QFutureWatcher<QList<QList<QVariant>>>(this);
|
||||
|
||||
connect(watcher, &QFutureWatcher<QList<QList<QVariant>>>::finished, this, [this, blockIndex, watcher]() {
|
||||
connect(watcher, &QFutureWatcher<QList<QList<QVariant>>>::finished, [this, blockIndex, watcher]() {
|
||||
if (watcher->future().isResultReadyAt(0)) {
|
||||
onBlockLoaded(blockIndex, watcher->future().result());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ VirtualTableView::VirtualTableView(QWidget* parent)
|
|||
connect(&m_scrollSpeedTimer, &QTimer::timeout, this, &VirtualTableView::handleScrollSpeedTimeout);
|
||||
|
||||
// 连接滚动条信号
|
||||
connect(verticalScrollBar(), &QScrollBar::valueChanged, this, [this](int value) {
|
||||
connect(verticalScrollBar(), &QScrollBar::valueChanged, [this](int value) {
|
||||
// 计算滚动速度
|
||||
if (m_scrollTimer.isValid()) {
|
||||
qint64 elapsed = m_scrollTimer.elapsed();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user