Skip to content
Snippets Groups Projects
Commit d7370d00 authored by Olivier Langella's avatar Olivier Langella
Browse files

WIP: new ptm sequence delegate

parent 3e7a8fe5
No related branches found
No related tags found
No related merge requests found
......@@ -131,6 +131,7 @@ SET(XTPCPP_SRCS
./gui/ptm_peptide_list_view/ptmpeptidelistwindow.cpp
./gui/ptm_peptide_list_view/ptmpeptidetablemodel.cpp
./gui/ptm_peptide_list_view/ptmpeptidetableproxymodel.cpp
./gui/ptm_peptide_list_view/ptmsequencedelegate.cpp
./gui/waiting_message_dialog/waitingmessagedialog.cpp
./gui/workerthread.cpp
./utils/workmonitor.cpp
......@@ -181,6 +182,7 @@ SET(XTPCPP_MOC_HDRS
./gui/ptm_peptide_list_view/ptmpeptidelistwindow.h
./gui/ptm_peptide_list_view/ptmpeptidetablemodel.h
./gui/ptm_peptide_list_view/ptmpeptidetableproxymodel.h
./gui/ptm_peptide_list_view/ptmsequencedelegate.h
./gui/waiting_message_dialog/waitingmessagedialog.h
./gui/workerthread.h
./utils/workmonitor.h
......
......@@ -44,7 +44,7 @@ typedef std::shared_ptr<PtmSampleScan> PtmSampleScanSp;
class PtmSampleScan
{
public:
PtmSampleScan(const PeptideMatch * p_peptide_match);
PtmSampleScan(const PeptideMatch * p_peptide_match=nullptr);
PtmSampleScan(const PtmSampleScan& other);
~PtmSampleScan();
......@@ -58,4 +58,5 @@ private:
};
Q_DECLARE_METATYPE(PtmSampleScan *)
#endif // PTMSAMPLESCAN_H
......@@ -29,6 +29,8 @@
#include "ptmpeptidelistwindow.h"
#include "../ptm_island_list_view/ptmislandlistwindow.h"
#include "ptmpeptidetablemodel.h"
#include "ptmsequencedelegate.h"
#include "ui_ptm_peptide_list_view.h"
......@@ -48,6 +50,8 @@ PtmPeptideListWindow::PtmPeptideListWindow(PtmIslandListWindow * parent):QMainWi
ui->ptm_peptide_tableview->setModel( _ptm_proxy_model_p );
ui->ptm_peptide_tableview->setSortingEnabled(true);
ui->ptm_peptide_tableview->setAlternatingRowColors(true);
PtmSequenceDelegate * p_sequence_delegate = new PtmSequenceDelegate();
ui->ptm_peptide_tableview->setItemDelegateForColumn((std::int8_t) PtmPeptideListColumn::sequence, p_sequence_delegate);
......
......@@ -199,7 +199,7 @@ QVariant PtmPeptideTableModel::data(const QModelIndex &index, int role ) const {
return QVariant ((quint32) _ptm_sample_scan_list.at(row).get()->getRepresentativePeptideMatch()->getCharge());
break;
case (std::int8_t)PtmPeptideListColumn::sequence:
return _ptm_sample_scan_list.at(row).get()->getRepresentativePeptideMatch()->getPeptideXtpSp().get()->getSequence();
return QVariant::fromValue( _ptm_sample_scan_list.at(row).get());
break;
case (std::int8_t)PtmPeptideListColumn::modifs:
return _ptm_sample_scan_list.at(row).get()->getRepresentativePeptideMatch()->getPeptideXtpSp().get()->getModifString();
......
/**
* \file gui/ptm_peptide_list_window/ptmsequencedelegate.cpp
* \date 28/7/2017
* \author Olivier Langella
*/
/*******************************************************************************
* Copyright (c) 2017 Olivier Langella <olivier.langella@u-psud.fr>.
*
* This file is part of XTPcpp.
*
* XTPcpp is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* XTPcpp is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XTPcpp. If not, see <http://www.gnu.org/licenses/>.
*
* Contributors:
* Olivier Langella <olivier.langella@u-psud.fr> - initial API and implementation
******************************************************************************/
#include "ptmsequencedelegate.h"
PtmSequenceDelegate::PtmSequenceDelegate(QWidget *parent) : QStyledItemDelegate(parent) {
}
void PtmSequenceDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
/*if (index.data().canConvert<StarRating>()) {
StarRating starRating = qvariant_cast<StarRating>(index.data());
if (option.state & QStyle::State_Selected)
painter->fillRect(option.rect, option.palette.highlight());
starRating.paint(painter, option.rect, option.palette,
StarRating::ReadOnly);
} else {*/
QStyledItemDelegate::paint(painter, option, index);
//}
}
/**
* \file gui/ptm_peptide_list_window/ptmsequencedelegate.h
* \date 28/7/2017
* \author Olivier Langella
*/
/*******************************************************************************
* Copyright (c) 2017 Olivier Langella <olivier.langella@u-psud.fr>.
*
* This file is part of XTPcpp.
*
* XTPcpp is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* XTPcpp is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XTPcpp. If not, see <http://www.gnu.org/licenses/>.
*
* Contributors:
* Olivier Langella <olivier.langella@u-psud.fr> - initial API and implementation
******************************************************************************/
#ifndef PTMSEQUENCEDELEGATE_H
#define PTMSEQUENCEDELEGATE_H
#include <QStyledItemDelegate>
class PtmSequenceDelegate : public QStyledItemDelegate
{
Q_OBJECT
public:
PtmSequenceDelegate(QWidget *parent = 0);
void paint(QPainter *painter, const QStyleOptionViewItem &option,
const QModelIndex &index) const override;
QSize sizeHint(const QStyleOptionViewItem &option,
const QModelIndex &index) const override;
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
const QModelIndex &index) const override;
void setEditorData(QWidget *editor, const QModelIndex &index) const override;
void setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index) const override;
};
#endif // PTMSEQUENCEDELEGATE_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