Loading...
Searching...
No Matches
pappso::OboListProxyModel Class Reference

`#include <obolistproxymodel.h>`

Inheritance diagram for pappso::OboListProxyModel:

## Public Member Functions

| OboListProxyModel (OboListModel *source_model, QObject *parent=nullptr)
| ~OboListProxyModel ()
void | filterMzPrecision (double target_mz, PrecisionPtr precision)

## Protected Member Functions

bool | lessThan (const QModelIndex &source_left, const QModelIndex &source_right) const override
bool | filterAcceptsRow (int source_row, const QModelIndex &source_parent) const override

## Private Attributes

PrecisionPtr | m_precisionPtr = nullptr
double | m_mzTarget = 0
OboListModel * | mp_sourceModel

## Detailed Description

Todo
  write docs

Definition at line 42 of file obolistproxymodel.h.

## Constructor & Destructor Documentation

## OboListProxyModel()

OboListProxyModel::OboListProxyModel | ( | OboListModel * | source_model,
|  | QObject * | parent = nullptr )

Default constructor

Definition at line 37 of file obolistproxymodel.cpp.

: QSortFilterProxyModel(parent)
{
setFilterRole(Qt::DisplayRole);
mp_sourceModel = source_model;
}
pappso::OboListProxyModel::mp_sourceModel
OboListModel * mp_sourceModel
Definition obolistproxymodel.h:66

References mp_sourceModel.

## ~OboListProxyModel()

OboListProxyModel::~OboListProxyModel | ( |  | ) |

Destructor

Definition at line 44 of file obolistproxymodel.cpp.

{
}

## Member Function Documentation

## filterAcceptsRow()

bool pappso::OboListProxyModel::filterAcceptsRow | ( | int | source_row,
|  | const QModelIndex & | source_parent ) const

override protected

Definition at line 69 of file obolistproxymodel.cpp.

{
// qDebug();
if(m_precisionPtr != nullptr)
{
MzRange range(m_mzTarget, m_precisionPtr);
OboPsiModTerm term = mp_sourceModel->getOboPsiModTerm(source_row);
/*
qDebug() << source_row << " " << source_parent.row() << " "
<< range.toString() << " " << term.m_diffMono << " "
<< term.m_accession;
*/
if(range.contains(term.m_diffMono))
{
// qDebug();
}
else
{
// qDebug() << "false";
return false;
}
}
return true;
}
pappso::OboListProxyModel::m_mzTarget
double m_mzTarget
Definition obolistproxymodel.h:65
pappso::OboListProxyModel::m_precisionPtr
PrecisionPtr m_precisionPtr
Definition obolistproxymodel.h:64
pappso::OboPsiModTerm::m_diffMono
double m_diffMono
Definition obopsimodterm.h:66

References pappso::MzRange::contains(), pappso::OboPsiModTerm::m_diffMono, m_mzTarget, m_precisionPtr, and mp_sourceModel.

## filterMzPrecision()

void pappso::OboListProxyModel::filterMzPrecision | ( | double | target_mz,
|  | pappso::PrecisionPtr | precision )

Definition at line 61 of file obolistproxymodel.cpp.

{
m_precisionPtr = precision;
m_mzTarget = target_mz;
invalidateFilter();
}

References m_mzTarget, and m_precisionPtr.

## lessThan()

bool pappso::OboListProxyModel::lessThan | ( | const QModelIndex & | source_left,
|  | const QModelIndex & | source_right ) const

override protected

Definition at line 49 of file obolistproxymodel.cpp.

{
// qDebug();
QVariant leftData = sourceModel()->data(source_left, Qt::UserRole);
QVariant rightData = sourceModel()->data(source_right, Qt::UserRole);
return leftData.value<OboPsiModTerm>().m_diffMono < rightData.value<OboPsiModTerm>().m_diffMono;
}

References pappso::OboListModel::data(), and pappso::OboPsiModTerm::m_diffMono.

## Member Data Documentation

## m_mzTarget

double pappso::OboListProxyModel::m_mzTarget = 0

private

Definition at line 65 of file obolistproxymodel.h.

Referenced by filterAcceptsRow(), and filterMzPrecision().

## m_precisionPtr

PrecisionPtr pappso::OboListProxyModel::m_precisionPtr = nullptr

private

Definition at line 64 of file obolistproxymodel.h.

Referenced by filterAcceptsRow(), and filterMzPrecision().

## mp_sourceModel

OboListModel* pappso::OboListProxyModel::mp_sourceModel

private

Definition at line 66 of file obolistproxymodel.h.

Referenced by OboListProxyModel(), and filterAcceptsRow().

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

- pappsomspp/gui/obo/obolistwidget/obolistproxymodel.h
- pappsomspp/gui/obo/obolistwidget/obolistproxymodel.cpp