Skip to content
Snippets Groups Projects
Commit 77230b44 authored by Renne Thomas's avatar Renne Thomas
Browse files

Add view menu to hide the peptide without PTM

parent 350c1ad2
No related branches found
No related tags found
1 merge request!25Correct Issue https://forgemia.inra.fr/pappso/xtpcpp/-/issues/28
......@@ -72,6 +72,14 @@ PtmPeptideListWindow::PtmPeptideListWindow(PtmIslandListWindow *parent)
&PtmPeptideListWindow::requestPeptideDetailView,
_p_ptm_island_list_window->getProjectWindowP(),
&ProjectWindow::doViewPeptideDetail);
connect(ui->actionOnly_peptide_wearing_PTM,
&QAction::changed,
this,
&PtmPeptideListWindow::doShowPtmPeptides);
connect(this,
&PtmPeptideListWindow::ptmPeptideChanged,
_ptm_table_model_p,
&PtmPeptideTableModel::onPtmPeptideDataChanged);
#else
// Qt4 code
// connect (this, SIGNAL(ptmIslandDataChanged()), _ptm_table_model_p,
......@@ -106,6 +114,20 @@ PtmPeptideListWindow::setPtmIsland(PtmIsland *p_ptm_island)
_p_ptm_island);
}
void
PtmPeptideListWindow::doShowPtmPeptides()
{
if(ui->actionOnly_peptide_wearing_PTM->isChecked())
{
_ptm_proxy_model_p->hideNoPtm(true);
}
else
{
_ptm_proxy_model_p->hideNoPtm(false);
}
emit ptmPeptideChanged();
}
void
PtmPeptideListWindow::askPeptideDetailView(PeptideEvidence *p_peptide_evidence)
{
......
......@@ -55,7 +55,10 @@ class PtmPeptideListWindow : public QMainWindow
signals:
void requestPeptideDetailView(PeptideEvidence *p_peptide_evidence);
void ptmPeptideChanged();
public slots:
void doShowPtmPeptides();
private:
PtmIsland *_p_ptm_island = nullptr;
......
......@@ -362,3 +362,9 @@ PtmPeptideTableModel::setPtmIsland(
// this->_p_ptm_island_list_window->resizeColumnsToContents();
}
void
PtmPeptideTableModel::onPtmPeptideDataChanged()
{
emit layoutAboutToBeChanged();
emit layoutChanged();
}
......@@ -89,6 +89,9 @@ class PtmPeptideTableModel : public QAbstractTableModel
static const QString getTitle(std::int8_t column);
static const QString getDescription(std::int8_t column);
public slots:
void onPtmPeptideDataChanged();
private:
std::vector<PtmSampleScanSp> _ptm_sample_scan_list;
const PtmIsland *_p_ptm_island;
......
......@@ -31,6 +31,7 @@
#include "ptmpeptidetablemodel.h"
#include "ptmpeptidelistwindow.h"
#include "../../grouping/ptm/ptmgroupingexperiment.h"
#include <pappsomspp/pappsoexception.h>
#include <QTextDocument>
PtmPeptideMenuQicon::PtmPeptideMenuQicon(
......@@ -176,6 +177,48 @@ PtmPeptideTableProxyModel::lessThan(const QModelIndex &left,
}
}
bool
PtmPeptideTableProxyModel::filterAcceptsRow(int source_row,
const QModelIndex &source_parent
[[maybe_unused]]) const
{
try
{
PtmSampleScanSp sample_scan =
_p_ptm_table_model->getPtmSampleScanSpList().at(source_row);
if(m_hideNoPtm)
{
if(sample_scan
->getObservedPtmPositionList(
_p_ptm_table_model->getPtmGroupingExperiment())
.size() == 0)
{
return false;
}
}
}
catch(pappso::PappsoException &exception_pappso)
{
qDebug() << "Error in PtmPeptideTableProxyModel::acceptRow :"
<< exception_pappso.qwhat();
}
catch(std::exception &exception_std)
{
qDebug() << "Error in PtmPeptideTableProxyModel::acceptRow :"
<< exception_std.what();
}
return true;
}
void
PtmPeptideTableProxyModel::hideNoPtm(bool hide)
{
qDebug() << hide;
m_hideNoPtm = hide;
}
void
PtmPeptideTableProxyModel::showContextMenu(const QModelIndex &index)
{
......
......@@ -91,6 +91,9 @@ class PtmPeptideTableProxyModel : public QSortFilterProxyModel
~PtmPeptideTableProxyModel();
PtmPeptideListWindow *getPtmPeptideListWindowP();
bool filterAcceptsRow(int source_row,
const QModelIndex &source_parent) const override;
void hideNoPtm(bool hide);
public slots:
void onTableClicked(const QModelIndex &index);
......@@ -104,6 +107,7 @@ class PtmPeptideTableProxyModel : public QSortFilterProxyModel
PtmPeptideListWindow *_p_ptm_peptide_list_window;
PtmPeptideTableModel *_p_ptm_table_model;
QMenu *_p_context_menu = nullptr;
bool m_hideNoPtm = false;
};
#endif // PTMPEPTIDETABLEPROXYMODEL_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment