diff --git a/src/gui/peptide_list_view/peptidetablemodel.cpp b/src/gui/peptide_list_view/peptidetablemodel.cpp index b028f6b30294111e06ec37b5f65688f32aff0434..1f0a2ad7ab6b225bf3dfdf6142049e93eae7a504 100644 --- a/src/gui/peptide_list_view/peptidetablemodel.cpp +++ b/src/gui/peptide_list_view/peptidetablemodel.cpp @@ -55,7 +55,7 @@ PeptideTableModel::setProteinMatch(ProteinMatch *p_protein_match) // QModelIndex topLeft = createIndex(0,0); // QModelIndex bottomRight = createIndex(rowCount(),columnCount()); - std::set<PeptideListColumn> engine_columns; + _engine_columns_to_display.clear(); bool first = true; for(auto &&peptide_match : _p_protein_match->getPeptideMatchList()) { @@ -65,11 +65,15 @@ PeptideTableModel::setProteinMatch(ProteinMatch *p_protein_match) PeptideEvidenceParam::peptide_prophet_probability); if(!var.isNull()) { + _engine_columns_to_display.insert( + PeptideListColumn::peptide_prophet_probability); } var = peptide_match.getPeptideEvidence()->getParam( PeptideEvidenceParam::peptide_inter_prophet_probability); if(!var.isNull()) { + _engine_columns_to_display.insert( + PeptideListColumn::peptide_inter_prophet_probability); } first = false; } @@ -77,17 +81,24 @@ PeptideTableModel::setProteinMatch(ProteinMatch *p_protein_match) peptide_match.getPeptideEvidence()->getIdentificationEngine(); if(engine == IdentificationEngine::XTandem) { - engine_columns.insert(PeptideListColumn::tandem_hyperscore); + _engine_columns_to_display.insert( + PeptideListColumn::tandem_hyperscore); } else if(engine == IdentificationEngine::mascot) { - engine_columns.insert(PeptideListColumn::mascot_score); + _engine_columns_to_display.insert(PeptideListColumn::mascot_score); + _engine_columns_to_display.insert( + PeptideListColumn::mascot_expectation_value); } } + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ << " " + << _engine_columns_to_display.size(); _p_peptide_list_window->resizeColumnsToContents(); // emit dataChanged(topLeft, topLeft); - // emit headerDataChanged(Qt::Horizontal, 0,3); + // emit headerDataChanged(Qt::Horizontal, 0,33); + emit layoutAboutToBeChanged(); + emit layoutChanged(); qDebug() << "PeptideTableModel::setProteinMatch end "; } @@ -407,7 +418,7 @@ PeptideTableModel::getTitle(PeptideListColumn column) const QString PeptideTableModel::getDescription(PeptideListColumn column) { - qDebug() << "PeptideTableModel::columnCount begin "; + // qDebug() << "PeptideTableModel::columnCount begin "; return PeptideTableModel::getDescription((std::int8_t)column); // qDebug() << "ProteinTableModel::columnCount end "; } @@ -416,7 +427,7 @@ const QString PeptideTableModel::getTitle(std::int8_t column) { - qDebug() << "PeptideTableModel::getTitle begin " << column; + // qDebug() << "PeptideTableModel::getTitle begin " << column; switch(column) { @@ -586,7 +597,7 @@ PeptideTableModel::getDescription(std::int8_t column) int PeptideTableModel::getColumnWidth(int column) { - qDebug() << "PeptideTableModel::getColumnWidth " << column; + // qDebug() << "PeptideTableModel::getColumnWidth " << column; switch(column) { @@ -605,3 +616,21 @@ PeptideTableModel::getColumnWidth(int column) } return 100; } + + +bool +PeptideTableModel::hasColumn(PeptideListColumn column) +{ + if((std::int8_t)column < 21) + { + return true; + } + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ << " " + << _engine_columns_to_display.size(); + if(_engine_columns_to_display.find(column) != + _engine_columns_to_display.end()) + { + return true; + } + return false; +} diff --git a/src/gui/peptide_list_view/peptidetablemodel.h b/src/gui/peptide_list_view/peptidetablemodel.h index 549aa3378d9fdd112e7cafbd578e4a253f2a6a92..ed865d621924396970dd52a6dfabb09e750c20d5 100644 --- a/src/gui/peptide_list_view/peptidetablemodel.h +++ b/src/gui/peptide_list_view/peptidetablemodel.h @@ -87,6 +87,7 @@ class PeptideTableModel : public QAbstractTableModel static const QString getTitle(PeptideListColumn column); static const QString getDescription(PeptideListColumn column); static PeptideListColumn getPeptideListColumn(std::int8_t column); + bool hasColumn(PeptideListColumn column); void setProteinMatch(ProteinMatch *p_protein_match); ProteinMatch *getProteinMatch(); @@ -104,6 +105,8 @@ class PeptideTableModel : public QAbstractTableModel private: ProteinMatch *_p_protein_match = nullptr; PeptideListWindow *_p_peptide_list_window = nullptr; + //contains columns to display (present in this peptide match) + std::set<PeptideListColumn> _engine_columns_to_display; }; #endif // PEPTIDETABLEMODEL_H diff --git a/src/gui/peptide_list_view/peptidetableproxymodel.cpp b/src/gui/peptide_list_view/peptidetableproxymodel.cpp index 802675094992c4fb2504c2b6e305729cadfe95f4..5e9fa827b7bb520c00f9cf59a974d3184d846509 100644 --- a/src/gui/peptide_list_view/peptidetableproxymodel.cpp +++ b/src/gui/peptide_list_view/peptidetableproxymodel.cpp @@ -65,18 +65,23 @@ bool PeptideTableProxyModel::filterAcceptsColumn( int source_column, const QModelIndex &source_parent) const { - if(_peptide_table_model_p->getPeptideListColumn(source_column) == - PeptideListColumn::label) + if(_column_display[source_column]) { - if(_p_peptide_list_window->getProjectWindow() - ->getProjectP() - ->getLabelingMethodSp() - .get() == nullptr) + PeptideListColumn peptide_column = + _peptide_table_model_p->getPeptideListColumn(source_column); + if(peptide_column == PeptideListColumn::label) { - return false; + if(_p_peptide_list_window->getProjectWindow() + ->getProjectP() + ->getLabelingMethodSp() + .get() == nullptr) + { + return false; + } } + return _peptide_table_model_p->hasColumn(peptide_column); } - return _column_display[source_column]; + return false; } bool