实现添加选择峰信息到多道能量刻度
This commit is contained in:
parent
bfd9485c8b
commit
3a5b22be2d
|
|
@ -285,19 +285,6 @@ CustomQwtPlotXaxisSelector::~CustomQwtPlotXaxisSelector()
|
||||||
qDebug() << "~CustomQwtPlotXaxisSelector";
|
qDebug() << "~CustomQwtPlotXaxisSelector";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CustomQwtPlotXaxisSelector::end(bool ok)
|
|
||||||
{
|
|
||||||
if (!ok) {
|
|
||||||
clearSelection();
|
|
||||||
return QwtPlotPicker::end(ok);
|
|
||||||
}
|
|
||||||
if (_overlay->isVisible()) {
|
|
||||||
_overlay->setVisible(false);
|
|
||||||
plot()->replot();
|
|
||||||
}
|
|
||||||
emit selectionFinished(_min_x, _max_x);
|
|
||||||
return QwtPlotPicker::end(ok);
|
|
||||||
}
|
|
||||||
|
|
||||||
double CustomQwtPlotXaxisSelector::selectedMinX() const
|
double CustomQwtPlotXaxisSelector::selectedMinX() const
|
||||||
{
|
{
|
||||||
|
|
@ -344,6 +331,21 @@ void CustomQwtPlotXaxisSelector::move(const QPoint & pos)
|
||||||
QwtPlotPicker::move(pos);
|
QwtPlotPicker::move(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CustomQwtPlotXaxisSelector::end(bool ok)
|
||||||
|
{
|
||||||
|
if (!ok) {
|
||||||
|
clearSelection();
|
||||||
|
return QwtPlotPicker::end(ok);
|
||||||
|
}
|
||||||
|
if (_overlay->isVisible()) {
|
||||||
|
_overlay->setVisible(false);
|
||||||
|
plot()->replot();
|
||||||
|
}
|
||||||
|
if ( (_max_x - _min_x) > 3 ) {
|
||||||
|
emit selectionFinished(_min_x, _max_x);
|
||||||
|
}
|
||||||
|
return QwtPlotPicker::end(ok);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QColor getDistinctColorForManyCurves(int curve_index)
|
QColor getDistinctColorForManyCurves(int curve_index)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#include "BatchEneryScaleDialog.h"
|
#include "BatchEneryScaleDialog.h"
|
||||||
#include "ui_BatchEneryScaleDialog.h"
|
#include "ui_BatchEneryScaleDialog.h"
|
||||||
|
#include <QDoubleSpinBox>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
BatchEneryScaleDialog::BatchEneryScaleDialog(QWidget* parent)
|
BatchEneryScaleDialog::BatchEneryScaleDialog(QWidget* parent)
|
||||||
|
|
@ -7,14 +8,87 @@ BatchEneryScaleDialog::BatchEneryScaleDialog(QWidget* parent)
|
||||||
, ui(new Ui::BatchEneryScaleDialog)
|
, ui(new Ui::BatchEneryScaleDialog)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
this->setWindowTitle(QString(QStringLiteral(u"多通道能量刻度")));
|
||||||
this->setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint);
|
this->setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint);
|
||||||
this->setWindowModality(Qt::WindowModal);
|
this->setWindowModality(Qt::WindowModal);
|
||||||
this->setModal(false);
|
this->setModal(false);
|
||||||
|
|
||||||
ui->tablew_process_data->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
ui->tablew_process_data->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
||||||
ui->tablew_process_data->horizontalHeader()->setSectionResizeMode(
|
ui->tablew_process_data->horizontalHeader()->setSectionResizeMode(
|
||||||
ui->tablew_process_data->columnCount() - 1, QHeaderView::ResizeToContents);
|
ui->tablew_process_data->columnCount() - 1, QHeaderView::ResizeToContents);
|
||||||
ui->tablew_process_data->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
ui->tablew_process_data->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
||||||
|
|
||||||
|
ui->filter_set_enery_combo_box->addItem(QStringLiteral(u"所有设置能量"));
|
||||||
|
auto filterFunc = [this](){
|
||||||
|
ui->tablew_process_data->setCurrentItem(nullptr);
|
||||||
|
auto row_count = ui->tablew_process_data->rowCount();
|
||||||
|
const QString& channel_filter_text = ui->filter_channel_combo_box->currentText();
|
||||||
|
const QString& set_enery_filter_text = ui->filter_set_enery_combo_box->currentText();
|
||||||
|
for (int i = row_count - 1; i >= 0; i--) {
|
||||||
|
const QString& channel = ui->tablew_process_data->item(i, 0)->text();
|
||||||
|
const QString& set_enery = ui->tablew_process_data->item(i, 2)->text();
|
||||||
|
bool is_match_channel = false;
|
||||||
|
if (channel_filter_text != QStringLiteral(u"所有通道")) {
|
||||||
|
is_match_channel = (channel_filter_text == channel) ? false : true;
|
||||||
|
}
|
||||||
|
bool is_match_set_enery = false;
|
||||||
|
if (set_enery_filter_text != QStringLiteral(u"所有设置能量")) {
|
||||||
|
is_match_set_enery = (set_enery_filter_text == set_enery) ? false : true;
|
||||||
|
}
|
||||||
|
bool is_hidden = is_match_channel || is_match_set_enery;
|
||||||
|
ui->tablew_process_data->setRowHidden(i, is_hidden);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
connect(ui->filter_channel_combo_box, &QComboBox::currentTextChanged, filterFunc);
|
||||||
|
connect(ui->filter_set_enery_combo_box, &QComboBox::currentTextChanged, filterFunc);
|
||||||
|
|
||||||
|
connect(ui->btn_all_select, &QPushButton::clicked, [this](){
|
||||||
|
ui->tablew_process_data->setCurrentItem(nullptr);
|
||||||
|
auto row_count = ui->tablew_process_data->rowCount();
|
||||||
|
for (int i = 0; i < row_count; ++i) {
|
||||||
|
if (ui->tablew_process_data->isRowHidden(i)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
auto item = ui->tablew_process_data->item(i, 0);
|
||||||
|
if (item) {
|
||||||
|
item->setCheckState(Qt::Checked);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
connect(ui->btn_reserve_select, &QPushButton::clicked, [this](){
|
||||||
|
ui->tablew_process_data->setCurrentItem(nullptr);
|
||||||
|
auto row_count = ui->tablew_process_data->rowCount();
|
||||||
|
for (int i = 0; i < row_count - 1; i++) {
|
||||||
|
if (ui->tablew_process_data->isRowHidden(i)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
auto item = ui->tablew_process_data->item(i, 0);
|
||||||
|
if (item) {
|
||||||
|
Qt::CheckState check_state = (item->checkState() == Qt::Checked) ? Qt::Unchecked : Qt::Checked;
|
||||||
|
item->setCheckState(check_state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
connect(ui->btn_remove_selected, &QPushButton::clicked, [this](){
|
||||||
|
auto row_count = ui->tablew_process_data->rowCount();
|
||||||
|
for (int row = row_count - 1; row >= 0; --row) {
|
||||||
|
QTableWidgetItem* item = ui->tablew_process_data->item(row, 0);
|
||||||
|
if (Qt::Unchecked == item->checkState())
|
||||||
|
continue;
|
||||||
|
QPushButton* btn_remove_row = dynamic_cast<QPushButton*>(ui->tablew_process_data->cellWidget(row, 8));
|
||||||
|
if (btn_remove_row) {
|
||||||
|
ui->tablew_process_data->removeRow(row);
|
||||||
|
btn_remove_row->deleteLater();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this->updateSetEneryFilter();
|
||||||
|
});
|
||||||
|
connect(ui->btn_fit, &QPushButton::clicked, [this](){
|
||||||
|
|
||||||
|
});
|
||||||
|
connect(ui->btn_save, &QPushButton::clicked, [this](){
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
BatchEneryScaleDialog::~BatchEneryScaleDialog()
|
BatchEneryScaleDialog::~BatchEneryScaleDialog()
|
||||||
|
|
@ -22,15 +96,121 @@ BatchEneryScaleDialog::~BatchEneryScaleDialog()
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BatchEneryScaleDialog::SetChannelNameList(const QStringList &ch_name_list)
|
||||||
|
{
|
||||||
|
ui->filter_channel_combo_box->clear();
|
||||||
|
ui->filter_channel_combo_box->addItem(QString(QStringLiteral(u"所有通道")));
|
||||||
|
ui->filter_channel_combo_box->addItems(ch_name_list);
|
||||||
|
}
|
||||||
|
|
||||||
void BatchEneryScaleDialog::SetPeakResultDataModel(QAbstractTableModel* peaks_result_model)
|
void BatchEneryScaleDialog::SetPeakResultDataModel(QAbstractTableModel* peaks_result_model)
|
||||||
{
|
{
|
||||||
_peaks_result_model = peaks_result_model;
|
_peaks_result_model = peaks_result_model;
|
||||||
qDebug() << _peaks_result_model->rowCount();
|
if (_peaks_result_model) {
|
||||||
|
qDebug() << _peaks_result_model->rowCount();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BatchEneryScaleDialog::onSelectedScaleRange(double min, double max)
|
void BatchEneryScaleDialog::onSelectedScaleRange(double min, double max)
|
||||||
{
|
{
|
||||||
qDebug() << min << ", " << max;
|
if (!_peaks_result_model) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QDialog set_enery_dlg(this, Qt::Dialog | Qt::WindowCloseButtonHint);
|
||||||
|
set_enery_dlg.setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||||
|
set_enery_dlg.setFixedSize(300, 100);
|
||||||
|
set_enery_dlg.setSizeGripEnabled(false);
|
||||||
|
set_enery_dlg.setWindowTitle(QString(QStringLiteral(u"设置刻度能量")));
|
||||||
|
|
||||||
|
QLabel* set_enery_label = new QLabel(QString(QStringLiteral(u"刻度能量:")));
|
||||||
|
QDoubleSpinBox* spinbox_set_enery = new QDoubleSpinBox();
|
||||||
|
spinbox_set_enery->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||||
|
spinbox_set_enery->setRange(0.0f, std::numeric_limits<double>::max());
|
||||||
|
spinbox_set_enery->setSingleStep(1.0f);
|
||||||
|
spinbox_set_enery->setDecimals(3);
|
||||||
|
QHBoxLayout* layout_input = new QHBoxLayout();
|
||||||
|
layout_input->addWidget(set_enery_label);
|
||||||
|
layout_input->addWidget(spinbox_set_enery);
|
||||||
|
|
||||||
|
QPushButton* btn_ok = new QPushButton(QStringLiteral(u"确认"));
|
||||||
|
connect(btn_ok, &QPushButton::clicked, &set_enery_dlg, &QDialog::accept);
|
||||||
|
QPushButton* btn_cancel = new QPushButton(QStringLiteral(u"取消"));
|
||||||
|
connect(btn_cancel, &QPushButton::clicked, &set_enery_dlg, &QDialog::reject);
|
||||||
|
QHBoxLayout* layout_btns = new QHBoxLayout();
|
||||||
|
layout_btns->addStretch();
|
||||||
|
layout_btns->addWidget(btn_ok);
|
||||||
|
layout_btns->addWidget(btn_cancel);
|
||||||
|
|
||||||
|
QVBoxLayout* layout = new QVBoxLayout(&set_enery_dlg);
|
||||||
|
layout->addLayout(layout_input);
|
||||||
|
layout->addStretch();
|
||||||
|
layout->addLayout(layout_btns);
|
||||||
|
|
||||||
|
if (QDialog::Accepted == set_enery_dlg.exec()) {
|
||||||
|
double set_enery = spinbox_set_enery->value();
|
||||||
|
for (int i = 0; i < _peaks_result_model->rowCount(); i++) {
|
||||||
|
const QString& channel_name = _peaks_result_model->data(_peaks_result_model->index(i, 0)).toString();
|
||||||
|
int peak_pos = _peaks_result_model->data(_peaks_result_model->index(i, 1)).toInt();
|
||||||
|
int peak_fwhm = _peaks_result_model->data(_peaks_result_model->index(i, 6)).toInt();
|
||||||
|
if (min < peak_pos && peak_pos > max ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
int row = ui->tablew_process_data->rowCount();
|
||||||
|
ui->tablew_process_data->insertRow(row);
|
||||||
|
ui->tablew_process_data->setItem(row, 0, new QTableWidgetItem(channel_name));
|
||||||
|
ui->tablew_process_data->item(row, 0)->setCheckState(Qt::Unchecked);
|
||||||
|
ui->tablew_process_data->setItem(row, 1, new QTableWidgetItem(QString::number(peak_pos)));
|
||||||
|
ui->tablew_process_data->setItem(row, 2, new QTableWidgetItem(QString::number(set_enery)));
|
||||||
|
ui->tablew_process_data->setItem(row, 3, new QTableWidgetItem);
|
||||||
|
ui->tablew_process_data->setItem(row, 4, new QTableWidgetItem);
|
||||||
|
ui->tablew_process_data->setItem(row, 5, new QTableWidgetItem(QString::number(peak_fwhm)));
|
||||||
|
ui->tablew_process_data->setItem(row, 6, new QTableWidgetItem);
|
||||||
|
ui->tablew_process_data->setItem(row, 7, new QTableWidgetItem);
|
||||||
|
QTableWidgetItem* item = new QTableWidgetItem;
|
||||||
|
ui->tablew_process_data->setItem(row, 8, item);
|
||||||
|
QPushButton* btn_remove_row = new QPushButton(QStringLiteral(u"删除"));
|
||||||
|
btn_remove_row->setMaximumWidth(35);
|
||||||
|
connect(btn_remove_row, &QPushButton::clicked, [this, item, btn_remove_row]() {
|
||||||
|
item->setCheckState(Qt::Unchecked);
|
||||||
|
int remove_row = item->row();
|
||||||
|
ui->tablew_process_data->removeRow(remove_row);
|
||||||
|
btn_remove_row->deleteLater();
|
||||||
|
this->updateSetEneryFilter();
|
||||||
|
});
|
||||||
|
ui->tablew_process_data->setCellWidget(row, 8, btn_remove_row);
|
||||||
|
this->insertSetEneryValueToFilter(set_enery);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void BatchEneryScaleDialog::insertSetEneryValueToFilter(double enery)
|
||||||
|
{
|
||||||
|
int count = 0;
|
||||||
|
int index = ui->filter_set_enery_combo_box->findText(QString::number(enery));
|
||||||
|
if (index >= 0) {
|
||||||
|
count = ui->filter_set_enery_combo_box->itemData(index).toInt() + 1;
|
||||||
|
ui->filter_set_enery_combo_box->setItemData(index, count);
|
||||||
|
} else {
|
||||||
|
ui->filter_set_enery_combo_box->addItem(QString::number(enery), count);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void BatchEneryScaleDialog::updateSetEneryFilter()
|
||||||
|
{
|
||||||
|
int item_count = ui->filter_set_enery_combo_box->count();
|
||||||
|
for (int index = item_count - 1; index >= 1; --index) {
|
||||||
|
int count = ui->filter_set_enery_combo_box->itemData(index).toInt();
|
||||||
|
count = count - 1;
|
||||||
|
ui->filter_set_enery_combo_box->setItemData(index, count);
|
||||||
|
if (0 == count) {
|
||||||
|
int current_index = ui->filter_set_enery_combo_box->currentIndex();
|
||||||
|
if (index == current_index) {
|
||||||
|
ui->filter_set_enery_combo_box->setCurrentIndex(0);
|
||||||
|
}
|
||||||
|
ui->filter_set_enery_combo_box->removeItem(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BatchEneryScaleDialog::closeEvent(QCloseEvent *e)
|
void BatchEneryScaleDialog::closeEvent(QCloseEvent *e)
|
||||||
|
|
|
||||||
|
|
@ -17,11 +17,16 @@ public:
|
||||||
explicit BatchEneryScaleDialog(QWidget *parent = nullptr);
|
explicit BatchEneryScaleDialog(QWidget *parent = nullptr);
|
||||||
~BatchEneryScaleDialog();
|
~BatchEneryScaleDialog();
|
||||||
|
|
||||||
|
void SetChannelNameList(const QStringList& ch_name_list);
|
||||||
void SetPeakResultDataModel(QAbstractTableModel *peaks_result_model);
|
void SetPeakResultDataModel(QAbstractTableModel *peaks_result_model);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void onSelectedScaleRange(double min, double max);
|
void onSelectedScaleRange(double min, double max);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void insertSetEneryValueToFilter(double enery);
|
||||||
|
void updateSetEneryFilter();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void close();
|
void close();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="comboBox_channel">
|
<widget class="QComboBox" name="filter_channel_combo_box">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>75</width>
|
<width>75</width>
|
||||||
|
|
@ -64,7 +64,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="comboBox_enery">
|
<widget class="QComboBox" name="filter_set_enery_combo_box">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>125</width>
|
<width>125</width>
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,10 @@
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
|
||||||
FindPeaksResultDialog::FindPeaksResultDialog(QWidget *parent)
|
FindPeaksResultDialog::FindPeaksResultDialog(QWidget *parent)
|
||||||
|
: QDialog(parent)
|
||||||
{
|
{
|
||||||
this->setWindowTitle(QString(QStringLiteral(u"寻峰结果")));
|
this->setWindowTitle(QString(QStringLiteral(u"寻峰结果")));
|
||||||
|
this->setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint);
|
||||||
this->setWindowModality(Qt::WindowModal);
|
this->setWindowModality(Qt::WindowModal);
|
||||||
this->setModal(false);
|
this->setModal(false);
|
||||||
|
|
||||||
|
|
@ -75,7 +77,7 @@ FindPeaksResultDialog::FindPeaksResultDialog(QWidget *parent)
|
||||||
connect(btn_all_select, &QPushButton::clicked, [this]() {
|
connect(btn_all_select, &QPushButton::clicked, [this]() {
|
||||||
_peaks_result_table->setCurrentItem(nullptr);
|
_peaks_result_table->setCurrentItem(nullptr);
|
||||||
auto row_count = _peaks_result_table->rowCount();
|
auto row_count = _peaks_result_table->rowCount();
|
||||||
for (int i = 0; i < row_count - 1; i++) {
|
for (int i = 0; i < row_count; i++) {
|
||||||
if (_peaks_result_table->isRowHidden(i)) {
|
if (_peaks_result_table->isRowHidden(i)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -88,7 +90,7 @@ FindPeaksResultDialog::FindPeaksResultDialog(QWidget *parent)
|
||||||
connect(btn_reserve_select, &QPushButton::clicked, [this]() {
|
connect(btn_reserve_select, &QPushButton::clicked, [this]() {
|
||||||
_peaks_result_table->setCurrentItem(nullptr);
|
_peaks_result_table->setCurrentItem(nullptr);
|
||||||
auto row_count = _peaks_result_table->rowCount();
|
auto row_count = _peaks_result_table->rowCount();
|
||||||
for (int i = 0; i < row_count - 1; i++) {
|
for (int i = 0; i < row_count; i++) {
|
||||||
if (_peaks_result_table->isRowHidden(i)) {
|
if (_peaks_result_table->isRowHidden(i)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ MeasureAnalysisParticleCountPlotView::MeasureAnalysisParticleCountPlotView(QWidg
|
||||||
setupPlot();
|
setupPlot();
|
||||||
setupMenu();
|
setupMenu();
|
||||||
setupPeakResultDlg();
|
setupPeakResultDlg();
|
||||||
|
setupEneryScaleDlg();
|
||||||
}
|
}
|
||||||
|
|
||||||
MeasureAnalysisParticleCountPlotView::~MeasureAnalysisParticleCountPlotView()
|
MeasureAnalysisParticleCountPlotView::~MeasureAnalysisParticleCountPlotView()
|
||||||
|
|
@ -85,6 +86,22 @@ void MeasureAnalysisParticleCountPlotView::SetAnalyzeDataFilename(const QMap<QSt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_data_files_set_ptr = data_files_set;
|
_data_files_set_ptr = data_files_set;
|
||||||
|
|
||||||
|
QStringList list_ch_names;
|
||||||
|
for (QwtPlotCurve* curve : this->_plot->GetCurveList()) {
|
||||||
|
list_ch_names.append(curve->title().text());
|
||||||
|
}
|
||||||
|
std::sort(list_ch_names.begin(), list_ch_names.end(), [](const QString& a, const QString& b) {
|
||||||
|
int num_a = ExtractNumberFromString(a);
|
||||||
|
int num_b = ExtractNumberFromString(b);
|
||||||
|
return num_a < num_b;
|
||||||
|
});
|
||||||
|
if (_find_peaks_result_dlg ) {
|
||||||
|
_find_peaks_result_dlg->SetChannelNameList(list_ch_names);
|
||||||
|
}
|
||||||
|
if (_batch_enery_scale_dlg ) {
|
||||||
|
_batch_enery_scale_dlg->SetChannelNameList(list_ch_names);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeasureAnalysisParticleCountPlotView::setupMenu()
|
void MeasureAnalysisParticleCountPlotView::setupMenu()
|
||||||
|
|
@ -144,7 +161,7 @@ void MeasureAnalysisParticleCountPlotView::setupPlot()
|
||||||
|
|
||||||
_plot->SetXaxisDragScale(true);
|
_plot->SetXaxisDragScale(true);
|
||||||
// new CustomQwtPlotXaxisPanner(_plot->canvas());
|
// new CustomQwtPlotXaxisPanner(_plot->canvas());
|
||||||
new CustomQwtPlotXaxisMagnifier(_plot->canvas());
|
// new CustomQwtPlotXaxisMagnifier(_plot->canvas());
|
||||||
_data_selector = new CustomQwtPlotXaxisSelector(_plot->canvas());
|
_data_selector = new CustomQwtPlotXaxisSelector(_plot->canvas());
|
||||||
_data_selector->setEnabled(false);
|
_data_selector->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
@ -153,22 +170,25 @@ void MeasureAnalysisParticleCountPlotView::setupPeakResultDlg()
|
||||||
{
|
{
|
||||||
if (!_find_peaks_result_dlg) {
|
if (!_find_peaks_result_dlg) {
|
||||||
_find_peaks_result_dlg = new FindPeaksResultDialog(this);
|
_find_peaks_result_dlg = new FindPeaksResultDialog(this);
|
||||||
QStringList list_ch_names;
|
|
||||||
for (QwtPlotCurve* curve : this->_plot->GetCurveList()) {
|
|
||||||
list_ch_names.append(curve->title().text());
|
|
||||||
}
|
|
||||||
std::sort(list_ch_names.begin(), list_ch_names.end(), [](const QString& a, const QString& b) {
|
|
||||||
int num_a = ExtractNumberFromString(a);
|
|
||||||
int num_b = ExtractNumberFromString(b);
|
|
||||||
return num_a < num_b;
|
|
||||||
});
|
|
||||||
_find_peaks_result_dlg->SetChannelNameList(list_ch_names);
|
|
||||||
connect(_find_peaks_result_dlg, &FindPeaksResultDialog::peakInfoChanged, [this](QVariantMap peak_infos){
|
connect(_find_peaks_result_dlg, &FindPeaksResultDialog::peakInfoChanged, [this](QVariantMap peak_infos){
|
||||||
this->updatePlotPeakInfo(peak_infos);
|
this->updatePlotPeakInfo(peak_infos);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MeasureAnalysisParticleCountPlotView::setupEneryScaleDlg()
|
||||||
|
{
|
||||||
|
if (!_batch_enery_scale_dlg) {
|
||||||
|
_batch_enery_scale_dlg = new BatchEneryScaleDialog(this);
|
||||||
|
_batch_enery_scale_dlg->SetPeakResultDataModel(_find_peaks_result_dlg->GetPeakResultDataModel());
|
||||||
|
connect(_data_selector, &CustomQwtPlotXaxisSelector::selectionFinished, _batch_enery_scale_dlg, &BatchEneryScaleDialog::onSelectedScaleRange);
|
||||||
|
connect(_batch_enery_scale_dlg, &BatchEneryScaleDialog::close, [this](){
|
||||||
|
this->_data_selector->setEnabled(false);
|
||||||
|
disconnect(_data_selector, &CustomQwtPlotXaxisSelector::selectionFinished, _batch_enery_scale_dlg, &BatchEneryScaleDialog::onSelectedScaleRange);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MeasureAnalysisParticleCountPlotView::loadDataFromFile(const QString& data_name, const QString& filename)
|
void MeasureAnalysisParticleCountPlotView::loadDataFromFile(const QString& data_name, const QString& filename)
|
||||||
{
|
{
|
||||||
std::string address_str = QString(QStringLiteral(u"道址")).toStdString();
|
std::string address_str = QString(QStringLiteral(u"道址")).toStdString();
|
||||||
|
|
@ -383,17 +403,10 @@ void MeasureAnalysisParticleCountPlotView::onActionManualFindPeaks()
|
||||||
|
|
||||||
void MeasureAnalysisParticleCountPlotView::onActionEneryScale()
|
void MeasureAnalysisParticleCountPlotView::onActionEneryScale()
|
||||||
{
|
{
|
||||||
if (!_batch_enery_scale_dlg) {
|
if (_batch_enery_scale_dlg && _data_selector) {
|
||||||
_batch_enery_scale_dlg = new BatchEneryScaleDialog(this);
|
_batch_enery_scale_dlg->show();
|
||||||
_batch_enery_scale_dlg->SetPeakResultDataModel(_find_peaks_result_dlg->GetPeakResultDataModel());
|
_data_selector->setEnabled(true);
|
||||||
connect(_data_selector, &CustomQwtPlotXaxisSelector::selectionFinished, _batch_enery_scale_dlg, &BatchEneryScaleDialog::onSelectedScaleRange);
|
|
||||||
connect(_batch_enery_scale_dlg, &BatchEneryScaleDialog::close, [this](){
|
|
||||||
this->_data_selector->setEnabled(false);
|
|
||||||
disconnect(_data_selector, &CustomQwtPlotXaxisSelector::selectionFinished, _batch_enery_scale_dlg, &BatchEneryScaleDialog::onSelectedScaleRange);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
_batch_enery_scale_dlg->show();
|
|
||||||
_data_selector->setEnabled(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeasureAnalysisParticleCountPlotView::onActionPlotConfigure()
|
void MeasureAnalysisParticleCountPlotView::onActionPlotConfigure()
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ private:
|
||||||
void setupMenu();
|
void setupMenu();
|
||||||
void setupPlot();
|
void setupPlot();
|
||||||
void setupPeakResultDlg();
|
void setupPeakResultDlg();
|
||||||
|
void setupEneryScaleDlg();
|
||||||
void loadDataFromFile(const QString &data_name, const QString& filename);
|
void loadDataFromFile(const QString &data_name, const QString& filename);
|
||||||
void loadPeaksResultToTable(QTableWidget* peaks_result_table);
|
void loadPeaksResultToTable(QTableWidget* peaks_result_table);
|
||||||
void updatePlotPeakInfo(const QVariantMap& peak_infos);
|
void updatePlotPeakInfo(const QVariantMap& peak_infos);
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ int main(int argc, char *argv[])
|
||||||
// 设置样式
|
// 设置样式
|
||||||
// app.setStyle(QStyleFactory::create("Fusion"));
|
// app.setStyle(QStyleFactory::create("Fusion"));
|
||||||
app.setWindowIcon(QIcon(":/logo/256.png"));
|
app.setWindowIcon(QIcon(":/logo/256.png"));
|
||||||
app.setQuitOnLastWindowClosed(true);
|
app.setQuitOnLastWindowClosed(false);
|
||||||
|
|
||||||
// 在应用程序可执行文件所在目录检查并创建Projects目录
|
// 在应用程序可执行文件所在目录检查并创建Projects目录
|
||||||
QString projects_dir_path = QDir(app.applicationDirPath()).filePath("Projects");
|
QString projects_dir_path = QDir(app.applicationDirPath()).filePath("Projects");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user