COPASI API  4.16.103
Public Member Functions | Protected Attributes | List of all members
CCopasiSelectionWidget Class Reference

#include <CCopasiSelectionWidget.h>

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

Public Member Functions

 CCopasiSelectionWidget (QWidget *parent=0)
 
void commit ()
 
bool expertMode () const
 
bool isSingleSelection () const
 
void populateTree (const CModel *model, const CQSimpleSelectionTree::ObjectClasses &classes)
 
void setExpertMode (bool expertMode)
 
void setOutputVector (std::vector< const CCopasiObject * > *outputVector)
 
void setSingleSelection (bool singleSelection)
 
 ~CCopasiSelectionWidget ()
 

Protected Attributes

bool mExpertMode
 
ObjectBrowserWidgetmpObjectBrowser
 
std::vector< const
CCopasiObject * > * 
mpOutputVector
 
CQSimpleSelectionTreempSimpleTree
 
bool mSingleSelect
 

Detailed Description

Definition at line 28 of file CCopasiSelectionWidget.h.

Constructor & Destructor Documentation

CCopasiSelectionWidget::CCopasiSelectionWidget ( QWidget *  parent = 0)

Definition at line 31 of file CCopasiSelectionWidget.cpp.

References mpSimpleTree, setExpertMode(), and setSingleSelection().

31  :
32  QStackedWidget(parent),
33  mpSimpleTree(NULL),
34  mpObjectBrowser(NULL),
35  mpOutputVector(NULL),
36  mSingleSelect(false),
37  mExpertMode(false)
38 {
39  this->mpSimpleTree = new CQSimpleSelectionTree(this);
40  this->addWidget(this->mpSimpleTree);
41  this->setSingleSelection(false);
42  this->setExpertMode(false);
43 }
std::vector< const CCopasiObject * > * mpOutputVector
void setExpertMode(bool expertMode)
CQSimpleSelectionTree * mpSimpleTree
void setSingleSelection(bool singleSelection)
ObjectBrowserWidget * mpObjectBrowser
CCopasiSelectionWidget::~CCopasiSelectionWidget ( )

Definition at line 45 of file CCopasiSelectionWidget.cpp.

References mpObjectBrowser, mpSimpleTree, and pdelete.

46 {
48  delete mpSimpleTree;
49 }
#define pdelete(p)
Definition: copasi.h:215
CQSimpleSelectionTree * mpSimpleTree
ObjectBrowserWidget * mpObjectBrowser

Member Function Documentation

void CCopasiSelectionWidget::commit ( )

Definition at line 151 of file CCopasiSelectionWidget.cpp.

References CQSimpleSelectionTree::commitClicked(), ObjectBrowserWidget::commitClicked(), mExpertMode, mpObjectBrowser, mpOutputVector, mpSimpleTree, and mSingleSelect.

Referenced by CCopasiSelectionDialog::okButton_clicked(), and CCopasiPlotSelectionDialog::slotOKButtonClicked().

152 {
153  if (this->mpOutputVector)
154  {
155  if (this->mExpertMode)
156  {
158 
159  if (this->mSingleSelect && this->mpOutputVector->size() > 1)
160  {
161  const CCopasiObject * object = this->mpOutputVector->at(0);
162  this->mpOutputVector->clear();
163  this->mpOutputVector->push_back(object);
164  }
165  }
166  else
167  {
168  this->mpSimpleTree->commitClicked();
169  }
170  }
171 }
std::vector< const CCopasiObject * > * mpOutputVector
CQSimpleSelectionTree * mpSimpleTree
ObjectBrowserWidget * mpObjectBrowser
bool CCopasiSelectionWidget::expertMode ( ) const

Definition at line 146 of file CCopasiSelectionWidget.cpp.

References mExpertMode.

Referenced by setExpertMode().

147 {
148  return this->mExpertMode;
149 }
bool CCopasiSelectionWidget::isSingleSelection ( ) const

Definition at line 106 of file CCopasiSelectionWidget.cpp.

References mSingleSelect.

107 {
108  return this->mSingleSelect;
109 }
void CCopasiSelectionWidget::populateTree ( const CModel model,
const CQSimpleSelectionTree::ObjectClasses classes 
)

Definition at line 51 of file CCopasiSelectionWidget.cpp.

References mpSimpleTree, and CQSimpleSelectionTree::populateTree().

Referenced by CCopasiPlotSelectionDialog::setModel(), and CCopasiSelectionDialog::setModel().

53 {
54  this->mpSimpleTree->populateTree(model, classes);
55 }
CQSimpleSelectionTree * mpSimpleTree
void populateTree(const CModel *pModel, const ObjectClasses &classes)
void CCopasiSelectionWidget::setExpertMode ( bool  expertMode)

Definition at line 111 of file CCopasiSelectionWidget.cpp.

References CQSimpleSelectionTree::commitClicked(), ObjectBrowserWidget::commitClicked(), expertMode(), mExpertMode, mpObjectBrowser, mpOutputVector, mpSimpleTree, CQSimpleSelectionTree::setOutputVector(), and ObjectBrowserWidget::setOutputVector().

Referenced by CCopasiSelectionWidget(), CCopasiSelectionDialog::modeButton_toggled(), and CCopasiPlotSelectionDialog::slotExpertCheckBoxToggled().

112 {
113  if (this->mExpertMode == expertMode) return;
114 
115  this->mExpertMode = expertMode;
116 
117  if (this->mExpertMode)
118  {
119  if (!this->mpObjectBrowser)
120  {
121  // create the object browser only if needed
122  // this saves some time if the model is large
123  this->mpObjectBrowser = new ObjectBrowserWidget(this);
124  this->addWidget(this->mpObjectBrowser);
125  }
126 
127  this->mpSimpleTree->commitClicked();
128  this->mpSimpleTree->setOutputVector(NULL);
130  this->setCurrentWidget(this->mpObjectBrowser);
131  }
132  else
133  {
134  // activate the SimpleTree and get the selection from the ObjectBrowser if there is one
135  if (this->mpObjectBrowser)
136  {
138  this->mpObjectBrowser->setOutputVector(NULL);
139  }
140 
142  this->setCurrentWidget(this->mpSimpleTree);
143  }
144 }
std::vector< const CCopasiObject * > * mpOutputVector
void setOutputVector(std::vector< const CCopasiObject * > *outputVector)
CQSimpleSelectionTree * mpSimpleTree
void setOutputVector(std::vector< const CCopasiObject * > *pObjectVector)
ObjectBrowserWidget * mpObjectBrowser
void CCopasiSelectionWidget::setOutputVector ( std::vector< const CCopasiObject * > *  outputVector)

Definition at line 57 of file CCopasiSelectionWidget.cpp.

References mExpertMode, mpObjectBrowser, mpOutputVector, mpSimpleTree, CQSimpleSelectionTree::setOutputVector(), and ObjectBrowserWidget::setOutputVector().

Referenced by CCopasiPlotSelectionDialog::CCopasiPlotSelectionDialog(), CCopasiSelectionDialog::CCopasiSelectionDialog(), CCopasiSelectionDialog::setOutputVector(), and CCopasiPlotSelectionDialog::setOutputVectors().

58 {
59  this->mpOutputVector = outputVector;
60 
61  if (this->mExpertMode)
62  {
64  }
65  else
66  {
68  }
69 }
std::vector< const CCopasiObject * > * mpOutputVector
void setOutputVector(std::vector< const CCopasiObject * > *outputVector)
CQSimpleSelectionTree * mpSimpleTree
void setOutputVector(std::vector< const CCopasiObject * > *pObjectVector)
ObjectBrowserWidget * mpObjectBrowser
void CCopasiSelectionWidget::setSingleSelection ( bool  singleSelection)

Definition at line 71 of file CCopasiSelectionWidget.cpp.

References mpObjectBrowser, mpSimpleTree, and mSingleSelect.

Referenced by CCopasiPlotSelectionDialog::CCopasiPlotSelectionDialog(), CCopasiSelectionWidget(), and CCopasiSelectionDialog::setSingleSelection().

72 {
73  if (this->mSingleSelect == singleSelection) return;
74 
75  this->mSingleSelect = singleSelection;
76  this->mpSimpleTree->clearSelection();
77 
78  if (this->mSingleSelect)
79  {
80  this->mpSimpleTree->setSelectionMode(QAbstractItemView::SingleSelection);
81 
82  if (this->mpObjectBrowser)
83  {
84  /* this needs to be implemented first !
85 
86  this->mpObjectBrowser->setSingleSelection(true);
87 
88  */
89  }
90  }
91  else
92  {
93  this->mpSimpleTree->setSelectionMode(QAbstractItemView::ExtendedSelection);
94 
95  if (this->mpObjectBrowser)
96  {
97  /* this needs to be implemented first !
98 
99  this->mpObjectBrowser->setSingleSelection(true);
100 
101  */
102  }
103  }
104 }
CQSimpleSelectionTree * mpSimpleTree
ObjectBrowserWidget * mpObjectBrowser

Member Data Documentation

bool CCopasiSelectionWidget::mExpertMode
protected

Definition at line 50 of file CCopasiSelectionWidget.h.

Referenced by commit(), expertMode(), setExpertMode(), and setOutputVector().

ObjectBrowserWidget* CCopasiSelectionWidget::mpObjectBrowser
protected
std::vector< const CCopasiObject * >* CCopasiSelectionWidget::mpOutputVector
protected

Definition at line 48 of file CCopasiSelectionWidget.h.

Referenced by commit(), setExpertMode(), and setOutputVector().

CQSimpleSelectionTree* CCopasiSelectionWidget::mpSimpleTree
protected
bool CCopasiSelectionWidget::mSingleSelect
protected

Definition at line 49 of file CCopasiSelectionWidget.h.

Referenced by commit(), isSingleSelection(), and setSingleSelection().


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