COPASI API  4.16.103
Public Member Functions | Protected Slots | Protected Attributes | Private Member Functions | List of all members
CQExperimentSelection Class Reference

#include <CQExperimentSelection.h>

Inheritance diagram for CQExperimentSelection:
Inheritance graph
[legend]
Collaboration diagram for CQExperimentSelection:
Collaboration graph
[legend]

Public Member Functions

 CQExperimentSelection (QWidget *parent=0, const char *name=0, bool modal=false, Qt::WindowFlags fl=0)
 
virtual void load (QComboBox *pBox, const CExperimentSet *pExperimentSet)
 
 ~CQExperimentSelection ()
 

Protected Slots

void slotBtnAll ()
 
void slotBtnCancel ()
 
void slotBtnNone ()
 
void slotBtnOK ()
 

Protected Attributes

QComboBox * mpBox
 

Private Member Functions

void init ()
 

Detailed Description

Definition at line 25 of file CQExperimentSelection.h.

Constructor & Destructor Documentation

CQExperimentSelection::CQExperimentSelection ( QWidget *  parent = 0,
const char *  name = 0,
bool  modal = false,
Qt::WindowFlags  fl = 0 
)

Definition at line 32 of file CQExperimentSelection.cpp.

References init().

33  : QDialog(parent, fl)
34 {
35  setObjectName(QString::fromUtf8(name));
36  setModal(modal);
37  setupUi(this);
38 
39  init();
40 }
bool fl(const C_FLOAT64 &d1, const C_FLOAT64 &d2)
CQExperimentSelection::~CQExperimentSelection ( )

Definition at line 45 of file CQExperimentSelection.cpp.

46 {
47  // no need to delete child widgets, Qt does it all for us
48 }

Member Function Documentation

void CQExperimentSelection::init ( )
private

Definition at line 125 of file CQExperimentSelection.cpp.

References mpBox.

Referenced by CQExperimentSelection().

126 {
127  mpBox = NULL;
128 }
void CQExperimentSelection::load ( QComboBox *  pBox,
const CExperimentSet pExperimentSet 
)
virtual

Definition at line 91 of file CQExperimentSelection.cpp.

References FROM_UTF8, CExperimentSet::getExperiment(), CExperimentSet::getExperimentCount(), CCopasiObject::getObjectName(), mpBox, and slotBtnAll().

Referenced by CQFittingItemWidget::slotCrossValidations(), and CQFittingItemWidget::slotExperiments().

92 {
93  mpBox = pBox;
94  mpList->clear();
95 
96  QStringList Items;
97  size_t i, imax = pExperimentSet->getExperimentCount();
98 
99  for (i = 0; i < imax; i++)
100  {
101  Items.append(FROM_UTF8(pExperimentSet->getExperiment(i)->getObjectName()));
102  }
103 
104  mpList->addItems(Items);
105 
106  int j, jmax = mpBox->count();
107 
108  if (jmax == 0)
109  {
110  slotBtnAll();
111  return;
112  }
113 
114  for (j = 0; j < jmax; j++)
115  {
116  QList< QListWidgetItem * > Found = mpList->findItems(mpBox->itemText(j), Qt::MatchExactly);
117 
118  if (Found.size() > 0)
119  {
120  Found[0]->setSelected(true);
121  }
122  }
123 }
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
const std::string & getObjectName() const
CExperiment * getExperiment(const size_t &index)
size_t getExperimentCount() const
void CQExperimentSelection::slotBtnAll ( )
protectedslot

Definition at line 81 of file CQExperimentSelection.cpp.

Referenced by load().

82 {
83  mpList->selectAll();
84 }
void CQExperimentSelection::slotBtnCancel ( )
protectedslot

Definition at line 76 of file CQExperimentSelection.cpp.

77 {
78  reject();
79 }
void CQExperimentSelection::slotBtnNone ( )
protectedslot

Definition at line 86 of file CQExperimentSelection.cpp.

87 {
88  mpList->clearSelection();
89 }
void CQExperimentSelection::slotBtnOK ( )
protectedslot

Definition at line 50 of file CQExperimentSelection.cpp.

References mpBox.

51 {
52  mpBox->clear();
53 
54  if (mpList->selectedItems().count() != mpList->count())
55  {
56  QListWidgetItem * pItem;
57  QStringList Items;
58  int i, imax = mpList->count();
59 
60  for (i = 0; i != imax; ++i)
61  {
62  pItem = mpList->item(i);
63 
64  if (pItem->isSelected())
65  {
66  Items.append(pItem->text());
67  }
68  }
69 
70  mpBox->addItems(Items);
71  }
72 
73  accept();
74 }

Member Data Documentation

QComboBox* CQExperimentSelection::mpBox
protected

Definition at line 36 of file CQExperimentSelection.h.

Referenced by init(), load(), and slotBtnOK().


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