From dc273f3d5e6c82a437bb909b187b19be3d0204b3 Mon Sep 17 00:00:00 2001 From: Olivier Langella <olivier.langella@u-psud.fr> Date: Mon, 14 Aug 2017 22:51:49 +0200 Subject: [PATCH] multi ptm peptide menu works ./src/xtpcpp ! --- .../ptmpeptidetableproxymodel.cpp | 17 +++++++++++++---- .../ptmpeptidetableproxymodel.h | 9 ++++++++- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/gui/ptm_peptide_list_view/ptmpeptidetableproxymodel.cpp b/src/gui/ptm_peptide_list_view/ptmpeptidetableproxymodel.cpp index fdd8605b..0c383a00 100644 --- a/src/gui/ptm_peptide_list_view/ptmpeptidetableproxymodel.cpp +++ b/src/gui/ptm_peptide_list_view/ptmpeptidetableproxymodel.cpp @@ -56,8 +56,10 @@ void PtmPeptideMenuQicon::paint(QPainter *painter, const QRect &rect, Qt::Alignm } -PtmPeptideMenuQaction::PtmPeptideMenuQaction(PtmPeptideTableProxyModel * parent, const PtmGroupingExperiment * p_ptm_grouping_experiment, const PtmSampleScan * p_ptm_sample, const PeptideMatch * p_peptide_match):QAction(parent) { +PtmPeptideMenuQaction::PtmPeptideMenuQaction(PtmPeptideTableProxyModel * parent, const PtmGroupingExperiment * p_ptm_grouping_experiment, const PtmSampleScan * p_ptm_sample, PeptideMatch * p_peptide_match):QAction(parent) { + _p_ptm_peptide_table_proxy_model = parent; + _p_peptide_match = p_peptide_match; this->setIcon(PtmPeptideMenuQicon(p_ptm_sample, p_peptide_match)); //this->setText(p_peptide_match->getPeptideXtpSp().get()->getSequence()); @@ -78,9 +80,12 @@ PtmPeptideMenuQaction::PtmPeptideMenuQaction(PtmPeptideTableProxyModel * parent, */ #else // Qt4 code - connect (this, SIGNAL(toggled(bool)), this,SLOT(doToggled(bool))); + connect (this, SIGNAL(triggered(bool)), this,SLOT(doTriggered(bool))); #endif } +void PtmPeptideMenuQaction::doTriggered(bool triggered) { + _p_ptm_peptide_table_proxy_model->getPtmPeptideListWindowP()->askPeptideDetailView(_p_peptide_match); +} PtmPeptideMenuQaction::~PtmPeptideMenuQaction() { @@ -98,6 +103,9 @@ PtmPeptideTableProxyModel::~PtmPeptideTableProxyModel() { } +PtmPeptideListWindow * PtmPeptideTableProxyModel::getPtmPeptideListWindowP() { + return _p_ptm_peptide_list_window; +} bool PtmPeptideTableProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const @@ -150,8 +158,9 @@ void PtmPeptideTableProxyModel::onTableClicked(const QModelIndex &index) if (sp_ptm_sample_scan.get()->getPeptideMatchList().size() == 1) { _p_ptm_peptide_list_window->askPeptideDetailView(sp_ptm_sample_scan.get()->getPeptideMatchList().at(0)); } - this->showContextMenu(index); - + else { + this->showContextMenu(index); + } qDebug() << "PtmPeptideTableProxyModel::onTableClicked end " << index.row(); } diff --git a/src/gui/ptm_peptide_list_view/ptmpeptidetableproxymodel.h b/src/gui/ptm_peptide_list_view/ptmpeptidetableproxymodel.h index 8336d9e1..bf89f4d2 100644 --- a/src/gui/ptm_peptide_list_view/ptmpeptidetableproxymodel.h +++ b/src/gui/ptm_peptide_list_view/ptmpeptidetableproxymodel.h @@ -57,10 +57,15 @@ class PtmPeptideMenuQaction: public QAction { Q_OBJECT public: - explicit PtmPeptideMenuQaction(PtmPeptideTableProxyModel * parent, const PtmGroupingExperiment * p_ptm_grouping_experiment, const PtmSampleScan * p_ptm_sample, const PeptideMatch * p_peptide_match); + explicit PtmPeptideMenuQaction(PtmPeptideTableProxyModel * parent, const PtmGroupingExperiment * p_ptm_grouping_experiment, const PtmSampleScan * p_ptm_sample, PeptideMatch * p_peptide_match); ~PtmPeptideMenuQaction(); + +public slots: + void doTriggered(bool triggered); private: + PeptideMatch * _p_peptide_match; + PtmPeptideTableProxyModel * _p_ptm_peptide_table_proxy_model; }; @@ -70,6 +75,8 @@ class PtmPeptideTableProxyModel: public QSortFilterProxyModel public: PtmPeptideTableProxyModel(PtmPeptideListWindow * p_ptm_peptide_list_window, PtmPeptideTableModel* ptm_table_model_p); ~PtmPeptideTableProxyModel(); + + PtmPeptideListWindow * getPtmPeptideListWindowP(); public slots: void onTableClicked(const QModelIndex &index); -- GitLab