libpappsomspp
Library for mass spectrometry
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 76 of file obolistmodel.cpp.

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

◆ getOboPsiModTerm()

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

Definition at line 125 of file obolistmodel.cpp.

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

◆ loadPsiMod()

void OboListModel::loadPsiMod ( )

Definition at line 67 of file obolistmodel.cpp.

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

References m_oboPsiModTermList.

Referenced by pappso::OboListWidget::OboListWidget().

◆ rowCount()

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

Definition at line 119 of file obolistmodel.cpp.

120 {
121  return (int)m_oboPsiModTermList.size();
122 }

Member Data Documentation

◆ m_oboPsiModTermList

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

Definition at line 83 of file obolistmodel.h.

Referenced by loadPsiMod().


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