libpappsomspp
Library for mass spectrometry
pappso::OboListWidget Class Reference

#include <obolistwidget.h>

Inheritance diagram for pappso::OboListWidget:

Signals

void oboTermChanged (OboPsiModTerm oboTerm) const
 

Public Member Functions

 OboListWidget (QWidget *parent=nullptr)
 
 ~OboListWidget ()
 
void filterMzPrecision (double target_mz, PrecisionPtr precision)
 
double getMzTarget () const
 get the current mz value used to filter term list More...
 
PrecisionPtr getPrecisionPtr () const
 get the current precision used to filter term list More...
 

Private Slots

void onSelectionChanged (const QItemSelection &selected, const QItemSelection &deselected)
 
void onFilterChanged ()
 
void onFilterChanged (pappso::PrecisionPtr precision)
 

Private Attributes

Ui::OboListWidgetForm * ui
 
OboListModelmpa_oboListModel = nullptr
 
OboListProxyModelmpa_oboListProxyModel = nullptr
 

Detailed Description

Definition at line 49 of file obolistwidget.h.

Constructor & Destructor Documentation

◆ OboListWidget()

OboListWidget::OboListWidget ( QWidget *  parent = nullptr)
explicit

Default constructor

Definition at line 38 of file obolistwidget.cpp.

39  : QWidget(parent), ui(new Ui::OboListWidgetForm)
40 {
41  qDebug();
42  ui->setupUi(this);
43 
44  mpa_oboListModel = new OboListModel(this);
46 
48  mpa_oboListProxyModel->setSourceModel(mpa_oboListModel);
49  // mpa_oboListProxyModel->setSortRole(Qt::UserRole);
50 
51  ui->oboTermListView->setModel(mpa_oboListProxyModel);
52 
53  mpa_oboListProxyModel->sort(Qt::AscendingOrder);
54 
55  connect(ui->oboTermListView->selectionModel(),
56  &QItemSelectionModel::selectionChanged,
57  this,
59 }
Ui::OboListWidgetForm * ui
Definition: obolistwidget.h:85
OboListProxyModel * mpa_oboListProxyModel
Definition: obolistwidget.h:88
void onSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
OboListModel * mpa_oboListModel
Definition: obolistwidget.h:87

References pappso::OboListModel::loadPsiMod(), mpa_oboListModel, mpa_oboListProxyModel, onSelectionChanged(), and ui.

◆ ~OboListWidget()

OboListWidget::~OboListWidget ( )

Destructor

Definition at line 61 of file obolistwidget.cpp.

62 {
63  delete ui;
64  if(mpa_oboListProxyModel != nullptr)
65  {
66  delete mpa_oboListProxyModel;
67  }
68  if(mpa_oboListModel != nullptr)
69  {
70  delete mpa_oboListModel;
71  }
72 }

References mpa_oboListModel, mpa_oboListProxyModel, and ui.

Member Function Documentation

◆ filterMzPrecision()

void pappso::OboListWidget::filterMzPrecision ( double  target_mz,
pappso::PrecisionPtr  precision 
)

Definition at line 93 of file obolistwidget.cpp.

95 {
96  qDebug();
97  mpa_oboListProxyModel->filterMzPrecision(target_mz, precision);
98  if(precision == nullptr)
99  {
100  ui->massFilterGroupBox->setChecked(false);
101  ui->mzSpinBox->setValue(target_mz);
102  }
103  else
104  {
105  ui->massFilterGroupBox->setChecked(true);
106  ui->precisionWidget->setPrecision(precision);
107  ui->mzSpinBox->setValue(target_mz);
108  }
109 }
void filterMzPrecision(double target_mz, PrecisionPtr precision)

◆ getMzTarget()

double pappso::OboListWidget::getMzTarget ( ) const

get the current mz value used to filter term list

Definition at line 134 of file obolistwidget.cpp.

135 {
136  return ui->mzSpinBox->value();
137 }

◆ getPrecisionPtr()

pappso::PrecisionPtr pappso::OboListWidget::getPrecisionPtr ( ) const

get the current precision used to filter term list

Definition at line 140 of file obolistwidget.cpp.

141 {
142  if(ui->massFilterGroupBox->isChecked())
143  {
144  return ui->precisionWidget->getPrecision();
145  }
146  return nullptr;
147 }

◆ oboTermChanged

void pappso::OboListWidget::oboTermChanged ( OboPsiModTerm  oboTerm) const
signal

◆ onFilterChanged [1/2]

void pappso::OboListWidget::onFilterChanged ( )
privateslot

Definition at line 112 of file obolistwidget.cpp.

113 {
114  qDebug();
115  if(ui->massFilterGroupBox->isChecked())
116  {
118  ui->mzSpinBox->value(), ui->precisionWidget->getPrecision());
119  }
120  else
121  {
123  }
124 }

◆ onFilterChanged [2/2]

void pappso::OboListWidget::onFilterChanged ( pappso::PrecisionPtr  precision)
privateslot

◆ onSelectionChanged

void pappso::OboListWidget::onSelectionChanged ( const QItemSelection &  selected,
const QItemSelection &  deselected 
)
privateslot

Definition at line 75 of file obolistwidget.cpp.

78 {
79  QModelIndexList index_list =
80  mpa_oboListProxyModel->mapSelectionToSource(selected).indexes();
81 
82  if(index_list.size() > 0)
83  {
84  QModelIndex index = index_list.first();
85  OboPsiModTerm term =
86  mpa_oboListModel->data(index, Qt::UserRole).value<OboPsiModTerm>();
87  qDebug() << term.m_accession;
88  emit oboTermChanged(term);
89  }
90 }
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
void oboTermChanged(OboPsiModTerm oboTerm) const

References pappso::OboPsiModTerm::m_accession.

Referenced by OboListWidget().

Member Data Documentation

◆ mpa_oboListModel

OboListModel* pappso::OboListWidget::mpa_oboListModel = nullptr
private

Definition at line 87 of file obolistwidget.h.

Referenced by OboListWidget(), and ~OboListWidget().

◆ mpa_oboListProxyModel

OboListProxyModel* pappso::OboListWidget::mpa_oboListProxyModel = nullptr
private

Definition at line 88 of file obolistwidget.h.

Referenced by OboListWidget(), and ~OboListWidget().

◆ ui

Ui::OboListWidgetForm* pappso::OboListWidget::ui
private

Definition at line 85 of file obolistwidget.h.

Referenced by OboListWidget(), and ~OboListWidget().


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