libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
pappso::OboListModel Class Reference

#include <obolistmodel.h>

Inheritance diagram for pappso::OboListModel:

Classes

class  OboPsiModHandler
 

Public Member Functions

 OboListModel (QObject *parent=nullptr)
 
 ~OboListModel ()
 
void loadPsiMod ()
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 
const OboPsiModTermgetOboPsiModTerm (int row) const
 

Protected Attributes

std::vector< OboPsiModTermm_oboPsiModTermList
 

Detailed Description

Todo
write docs

Definition at line 45 of file obolistmodel.h.

Constructor & Destructor Documentation

◆ OboListModel()

OboListModel::OboListModel ( QObject * parent = nullptr)

Default constructor

Definition at line 40 of file obolistmodel.cpp.

40 : QStringListModel(parent)
41{
42}

◆ ~OboListModel()

OboListModel::~OboListModel ( )

Destructor

Definition at line 44 of file obolistmodel.cpp.

45{
46}

Member Function Documentation

◆ data()

QVariant pappso::OboListModel::data ( const QModelIndex & index,
int role = Qt::DisplayRole ) const
override

Definition at line 74 of file obolistmodel.cpp.

75{
76
77 // generate a log message when this method gets called
78 std::size_t row = index.row();
79 // int col = index.column();
80 // qDebug() << QString("row %1, col%2, role %3")
81 // .arg(row).arg(col).arg(role);
82 if(row < m_oboPsiModTermList.size())
83 {
84
85 switch(role)
86 {
87 case Qt::CheckStateRole:
88
89 break;
90 case Qt::BackgroundRole:
91 // return QVariant(QColor("grey"));
92 break;
93 case Qt::SizeHintRole:
94 // qDebug() << "ProteinTableModel::headerData " <<
95 // ProteinTableModel::getColumnWidth(section);
96 // return QSize(PeptideTableModel::getColumnWidth(col), 30);
97 break;
98 case Qt::ToolTipRole:
99 break;
100 case Qt::DisplayRole:
101 return QVariant(QString("%1 %2 %3")
102 .arg(m_oboPsiModTermList[row].getAccession())
103 .arg(m_oboPsiModTermList[row].m_diffMono)
104 .arg(m_oboPsiModTermList[row].m_name));
105 break;
106 case Qt::UserRole:
107 QVariant value;
108 value.setValue(m_oboPsiModTermList[row]);
109 return value;
110 break;
111 }
112 }
113 return QVariant();
114}
std::vector< OboPsiModTerm > m_oboPsiModTermList

References m_oboPsiModTermList.

Referenced by pappso::OboListProxyModel::lessThan().

◆ getOboPsiModTerm()

const pappso::OboPsiModTerm & pappso::OboListModel::getOboPsiModTerm ( int row) const

Definition at line 123 of file obolistmodel.cpp.

124{
125 if(row < (int)m_oboPsiModTermList.size())
126 {
127 return m_oboPsiModTermList[row];
128 }
129 else
130 {
131 throw pappso::ExceptionNotFound(tr("OBO term not found"));
132 }
133}

References m_oboPsiModTermList.

◆ loadPsiMod()

void OboListModel::loadPsiMod ( )

Definition at line 65 of file obolistmodel.cpp.

66{
67 OboPsiModHandler handler(this);
68 OboPsiMod reader(handler);
69
70 qDebug() << m_oboPsiModTermList.size();
71}

References m_oboPsiModTermList.

◆ rowCount()

int pappso::OboListModel::rowCount ( const QModelIndex & parent = QModelIndex()) const
override

Definition at line 117 of file obolistmodel.cpp.

118{
119 return (int)m_oboPsiModTermList.size();
120}

References m_oboPsiModTermList.

Member Data Documentation

◆ m_oboPsiModTermList

std::vector<OboPsiModTerm> pappso::OboListModel::m_oboPsiModTermList
protected

Definition at line 83 of file obolistmodel.h.

Referenced by data(), getOboPsiModTerm(), loadPsiMod(), and rowCount().


The documentation for this class was generated from the following files: