diff --git a/src/gui/peptide_list_view/peptidelistwindow.cpp b/src/gui/peptide_list_view/peptidelistwindow.cpp index f933f6990abf3dfebd3b2dbaa20ba4c8bc2170e6..56927855f83ff8bf12aa0d807bf9ef55014cc59f 100644 --- a/src/gui/peptide_list_view/peptidelistwindow.cpp +++ b/src/gui/peptide_list_view/peptidelistwindow.cpp @@ -71,9 +71,11 @@ PeptideListWindow::~PeptideListWindow() void PeptideListWindow::setProteinMatch(Project * p_project, ProteinMatch * p_protein_match) { - _peptide_table_model_p->setProteinMatch(p_project, p_protein_match); - _p_proxy_model->setSourceModel(_peptide_table_model_p); - ui->proteinLabel->setText(p_protein_match->getProteinXtpSp().get()->getDescription()); + if (_p_protein_match != p_protein_match) { + _p_protein_match = p_protein_match; + _peptide_table_model_p->setProteinMatch(p_project, p_protein_match); + _p_proxy_model->setSourceModel(_peptide_table_model_p); + } } diff --git a/src/gui/peptide_list_view/peptidelistwindow.h b/src/gui/peptide_list_view/peptidelistwindow.h index 9917d62c84f6cb98db08eb66e9ecfe142623f783..98bcb5bcd5e0e0de348a1020928f126d56206af8 100644 --- a/src/gui/peptide_list_view/peptidelistwindow.h +++ b/src/gui/peptide_list_view/peptidelistwindow.h @@ -54,6 +54,7 @@ private: Ui::PeptideView *ui; PeptideTableModel * _peptide_table_model_p = nullptr; PeptideTableProxyModel * _p_proxy_model = nullptr; + ProteinMatch* _p_protein_match; }; diff --git a/src/gui/peptide_list_view/peptidetablemodel.cpp b/src/gui/peptide_list_view/peptidetablemodel.cpp index 204508f35c7159f52b02c7e3498beac68c4c0171..adb3894581507ea79da835d5b2b703fbd5701b98 100644 --- a/src/gui/peptide_list_view/peptidetablemodel.cpp +++ b/src/gui/peptide_list_view/peptidetablemodel.cpp @@ -84,8 +84,9 @@ void PeptideTableModel::setProteinMatch(Project * p_project, ProteinMatch * p_pr QModelIndex topLeft = createIndex(0,0); QModelIndex bottomRight = createIndex(rowCount(),columnCount()); - emit dataChanged(topLeft, bottomRight); + emit dataChanged(topLeft, topLeft); emit headerDataChanged(Qt::Horizontal, 0,3); + qDebug() << "PeptideTableModel::setProteinMatch end " ; } int PeptideTableModel::rowCount(const QModelIndex &parent ) const { diff --git a/src/gui/project_view/projectwindow.cpp b/src/gui/project_view/projectwindow.cpp index a4e6afeb68b9694dc78c81b06b6ccdce15b299eb..bb33ac45902154576118a491132bb764c33741af 100644 --- a/src/gui/project_view/projectwindow.cpp +++ b/src/gui/project_view/projectwindow.cpp @@ -83,7 +83,7 @@ void ProjectWindow::connectNewProteinListWindow() { */ #else // Qt4 code - connect (_p_current_protein_list_window, SIGNAL(proteinMatchClicked(ProteinMatch *)), this,SLOT(doProteinMatchClicked(ProteinMatch *))); + connect (_p_current_protein_list_window, SIGNAL(proteinMatchClicked(ProteinMatch *)), this,SLOT(doViewPeptideList(ProteinMatch *))); connect (_p_current_protein_list_window, SIGNAL(identificationGroupEdited(IdentificationGroup *)), this,SLOT(doIdentificationGroupEdited(IdentificationGroup *))); connect (this, SIGNAL(identificationGroupGrouped(IdentificationGroup *)), _p_current_protein_list_window,SLOT(doIdentificationGroupGrouped(IdentificationGroup *))); @@ -93,6 +93,30 @@ void ProjectWindow::connectNewProteinListWindow() { } +void ProjectWindow::connectNewPeptideListWindow() { + qDebug() << "ProjectWindow::connectNewPeptideListWindow begin"; + _p_current_peptide_list_window = new PeptideListWindow(this); + _peptide_list_window_collection.push_back(_p_current_peptide_list_window); + +#if QT_VERSION >= 0x050000 + // Qt5 code + /* + connect(&workerThread, &QThread::finished, worker, &QObject::deleteLater); + connect(this, &PtSpectrumViewer::operateMsDataFile, worker, &PwizLoaderThread::doMsDataFileLoad); + connect(worker, &PwizLoaderThread::msDataReady, this, &PtSpectrumViewer::handleMsDataFile); + */ +#else +// Qt4 code + //connect (_p_current_peptide_list_window, SIGNAL(proteinMatchClicked(ProteinMatch *)), this,SLOT(doViewPeptideList(ProteinMatch *))); + connect (_p_current_peptide_list_window, SIGNAL(identificationGroupEdited(IdentificationGroup *)), this,SLOT(doIdentificationGroupEdited(IdentificationGroup *))); + connect (this, SIGNAL(identificationGroupGrouped(IdentificationGroup *)), _p_current_peptide_list_window,SLOT(doIdentificationGroupGrouped(IdentificationGroup *))); + +#endif + + qDebug() << "ProjectWindow::connectNewPeptideListWindow end"; + +} + void ProjectWindow::doIdentificationGroupEdited(IdentificationGroup * p_ident_group) { qDebug() << "ProjectWindow::doIdentificationGroupEdited begin"; p_ident_group->startGrouping(_project_sp.get()->getGroupingType()); @@ -103,10 +127,22 @@ void ProjectWindow::doIdentificationGroupEdited(IdentificationGroup * p_ident_gr qDebug() << "ProjectWindow::doIdentificationGroupEdited end"; } -void ProjectWindow::doProteinMatchClicked(ProteinMatch * protein_match) { - PeptideListWindow * peptide_window = new PeptideListWindow(this); - peptide_window->setProteinMatch(_project_sp.get(), protein_match); - peptide_window->show(); +void ProjectWindow::doViewPeptideList(ProteinMatch * protein_match) { + + + qDebug() << "ProjectWindow::doViewPeptideList begin"; + if (_peptide_list_window_collection.size() == 0) { + connectNewPeptideListWindow(); + } + Qt::KeyboardModifiers modifier = QApplication::keyboardModifiers(); + if (modifier == Qt::ControlModifier) { + connectNewPeptideListWindow(); + } + + + _p_current_peptide_list_window->setProteinMatch(_project_sp.get(), protein_match); + _p_current_peptide_list_window->show(); + qDebug() << "ProjectWindow::doViewPeptideList end"; } void ProjectWindow::doViewProteinList(IdentificationGroup* p_identification_group) { diff --git a/src/gui/project_view/projectwindow.h b/src/gui/project_view/projectwindow.h index bba8045b35e3e1c4bdc57d548fd36f7d1dd43a07..fa20726ad3309e77fe09101c31fa634ad776bdd6 100644 --- a/src/gui/project_view/projectwindow.h +++ b/src/gui/project_view/projectwindow.h @@ -27,6 +27,7 @@ #include <QMainWindow> #include "../../core/project.h" #include "../protein_list_view/proteinlistwindow.h" +#include "../peptide_list_view/peptidelistwindow.h" class MainWindow; @@ -46,7 +47,7 @@ public: public slots: void doViewProteinList(IdentificationGroup* p_identification_group =nullptr); - void doProteinMatchClicked(ProteinMatch * protein_match); + void doViewPeptideList(ProteinMatch * protein_match); void doIdentificationGroupEdited(IdentificationGroup * p_identification_group); void setDefaultProteinListWindow(ProteinListWindow* p_protein_list_window); // void setColor(const QColor &color); @@ -57,11 +58,14 @@ signals: private : void connectNewProteinListWindow(); + void connectNewPeptideListWindow(); private: Ui::ProjectView *ui; MainWindow * main_window; std::list <ProteinListWindow *> _protein_list_window_collection; ProteinListWindow * _p_current_protein_list_window = nullptr; + std::list <PeptideListWindow *> _peptide_list_window_collection; + PeptideListWindow * _p_current_peptide_list_window = nullptr; ProjectSp _project_sp; diff --git a/src/gui/protein_list_view/proteintablemodel.cpp b/src/gui/protein_list_view/proteintablemodel.cpp index 041e9efc2ce7718c7e2ed28d636d3793f7bf3110..eb74f3cdcb47768da2cce5c813606d0839acc2a2 100644 --- a/src/gui/protein_list_view/proteintablemodel.cpp +++ b/src/gui/protein_list_view/proteintablemodel.cpp @@ -135,7 +135,7 @@ void ProteinTableModel::setIdentificationGroup(IdentificationGroup * p_identific QModelIndex topLeft = createIndex(0,0); QModelIndex bottomRight = createIndex(rowCount(),columnCount()); - emit dataChanged(topLeft, bottomRight); + emit dataChanged(topLeft, topLeft); emit headerDataChanged(Qt::Horizontal, 0,3); }