diff --git a/src/gui/project_view/projectwindow.cpp b/src/gui/project_view/projectwindow.cpp index e8c1f891cc05c1245937ab1d6d8ea83e4d561971..2b5767403bce92b74a0c834c5d1576b4241ea69f 100644 --- a/src/gui/project_view/projectwindow.cpp +++ b/src/gui/project_view/projectwindow.cpp @@ -648,6 +648,13 @@ void ProjectWindow::setProjectSp(ProjectSp project_sp) { delete wItem; } + if (_p_xic_window != nullptr) { + _p_xic_window->clear(); + _p_xic_window->hide(); + delete _p_xic_window; + _p_xic_window = nullptr; + } + qDebug() << " ProjectWindow::setProjectSp size=" << identification_list.size(); if (identification_list.size() == 1) { ui->identifications_combobox->setVisible(false); @@ -768,9 +775,9 @@ void ProjectWindow::openInXicViewer(const PeptideEvidence * p_peptide_evidence) if (_p_xic_window == nullptr) { _p_xic_window = new XicWindow(this); } - + _p_xic_window->show(); - + _p_xic_window->addXic(p_peptide_evidence); qDebug() << "ProjectWindow::openInXicViewer end"; } diff --git a/src/gui/xic_view/xic_box/xicbox.cpp b/src/gui/xic_view/xic_box/xicbox.cpp index 5a707ac7758454212f71d433c51557bef0f177fd..f483e1adcfa7b9a4cbd857ae32ad50556f94bc26 100644 --- a/src/gui/xic_view/xic_box/xicbox.cpp +++ b/src/gui/xic_view/xic_box/xicbox.cpp @@ -109,6 +109,11 @@ void XicBox::setXic(std::vector< pappso::XicSp> xic_sp_list) { } qDebug() << "XicBox::setXic xic_sp_list[i].size() " << xic_sp_list[i].get()->size(); ui->xic_widget->addXicSp(xic_sp_list[i]); + QString isotope_name = QString("+%1").arg(_isotope_mass_list[i].get()->getIsotopeNumber()); + if (_isotope_mass_list[i].get()->getIsotopeRank() > 1) { + isotope_name = QString("+%1 [%2]").arg(_isotope_mass_list[i].get()->getIsotopeNumber()).arg(_isotope_mass_list[i].get()->getIsotopeRank()); + } + ui->xic_widget->setName(xic_sp_list[i].get(), isotope_name); if (_isotope_mass_list[i].get()->getIsotopeNumber() == 0) { for (const PeptideEvidence * peptide_evidence:_peptide_evidence_list) { diff --git a/src/gui/xic_view/xicwindow.cpp b/src/gui/xic_view/xicwindow.cpp index c8c032a9d099c277e9c90a2206a1c2264bc93156..eb3b9a5646872bfe237395b1a64481d0b6f3c268 100644 --- a/src/gui/xic_view/xicwindow.cpp +++ b/src/gui/xic_view/xicwindow.cpp @@ -55,6 +55,16 @@ XicWindow::~XicWindow() { qDebug() << "XicWindow::~XicWindow"; } + +void XicWindow::clear() { + QLayoutItem *wItem; + while (wItem = ui->xic_vertical_layout->layout()->takeAt(0)) { + wItem->widget()->setVisible(false); + ui->xic_vertical_layout->layout()->removeWidget(wItem->widget()); + delete wItem->widget(); + } +} + ProjectWindow * XicWindow::getProjectWindow() { return _project_window; } diff --git a/src/gui/xic_view/xicwindow.h b/src/gui/xic_view/xicwindow.h index 11fcdf35bd5e5487ee79bff5b7e20ce63d87d367..a6445b10fafbe15496e270a07a258475daecee1c 100644 --- a/src/gui/xic_view/xicwindow.h +++ b/src/gui/xic_view/xicwindow.h @@ -45,16 +45,18 @@ class XicBox; class XicWindow: public QMainWindow { Q_OBJECT -friend XicBox; + friend XicBox; public: explicit XicWindow(ProjectWindow * parent = 0); ~XicWindow(); void addXic(const PeptideEvidence * p_peptide_evidence); - + pappso::PrecisionP getXicExtractPrecision() const; - + + void clear(); + protected: ProjectWindow * getProjectWindow(); void removeXicBox(XicBox * xic_box);