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

#include <SensWidgetComboBox.h>

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

Public Member Functions

void fillFromList (const std::vector< CObjectLists::ListType > &list)
 
CObjectLists::ListType getCurrentObjectList () const
 
 SensWidgetComboBox (QWidget *parent=0, const char *name=0)
 
bool setCurrentObjectList (CObjectLists::ListType lt)
 

Protected Attributes

std::vector
< CObjectLists::ListType
mIndexTable
 

Detailed Description

This class handles a combobox to choose from lists of object lists

Definition at line 36 of file SensWidgetComboBox.h.

Constructor & Destructor Documentation

SensWidgetComboBox::SensWidgetComboBox ( QWidget *  parent = 0,
const char *  name = 0 
)

Definition at line 33 of file SensWidgetComboBox.cpp.

34  : QComboBox(parent)
35 {
36  setObjectName(QString::fromUtf8(name));
37 }

Member Function Documentation

void SensWidgetComboBox::fillFromList ( const std::vector< CObjectLists::ListType > &  list)

this fills the combobox with a new list of entries. If the old current value is still allowed in the new list, it is set. Otherwise the box shows the first item.

Definition at line 39 of file SensWidgetComboBox.cpp.

References FROM_UTF8, getCurrentObjectList(), CObjectLists::ListTypeName, mIndexTable, and setCurrentObjectList().

40 {
41  //store old selection
43 
44  mIndexTable = list;
45 
46  //fill combobox
47  clear();
48  std::vector<CObjectLists::ListType>::const_iterator it, itEnd = mIndexTable.end();
49 
50  for (it = mIndexTable.begin(); it != itEnd; ++it)
51  insertItem(this->count(), FROM_UTF8(CObjectLists::ListTypeName[*it]));
52 
53  //restore old selection, if possible
54  if (!setCurrentObjectList(oldItem))
55  setCurrentIndex(0);
56 }
std::vector< CObjectLists::ListType > mIndexTable
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
CObjectLists::ListType getCurrentObjectList() const
static const std::string ListTypeName[]
Definition: CObjectLists.h:98
bool setCurrentObjectList(CObjectLists::ListType lt)
CObjectLists::ListType SensWidgetComboBox::getCurrentObjectList ( ) const

Definition at line 58 of file SensWidgetComboBox.cpp.

References CObjectLists::EMPTY_LIST, and mIndexTable.

Referenced by fillFromList(), and SensitivitiesWidget::updateLineeditEnable().

59 {
60  unsigned int index = currentIndex();
61 
62  if (index < mIndexTable.size())
63  return mIndexTable[currentIndex()];
64  else
66 }
std::vector< CObjectLists::ListType > mIndexTable
bool SensWidgetComboBox::setCurrentObjectList ( CObjectLists::ListType  lt)

set current selection (if possible). It returns true if the operation was successful.

Definition at line 68 of file SensWidgetComboBox.cpp.

References mIndexTable.

Referenced by fillFromList().

69 {
70  std::vector<CObjectLists::ListType>::const_iterator it;
71  it = std::find(mIndexTable.begin(),
72  mIndexTable.end(),
73  lt);
74 
75  if (it == mIndexTable.end()) return false;
76 
77  setCurrentIndex(it - mIndexTable.begin());
78  return true;
79 }
std::vector< CObjectLists::ListType > mIndexTable

Member Data Documentation

std::vector<CObjectLists::ListType> SensWidgetComboBox::mIndexTable
protected

Definition at line 61 of file SensWidgetComboBox.h.

Referenced by fillFromList(), getCurrentObjectList(), and setCurrentObjectList().


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