stable
v1.7.0
| Rev | Line | |
|---|
| [6d1e0a] | 1 | /*
|
|---|
| 2 | * QtMoleculeItem_name.hpp
|
|---|
| 3 | *
|
|---|
| 4 | * Created on: Jan 18, 2015
|
|---|
| 5 | * Author: heber
|
|---|
| 6 | */
|
|---|
| 7 |
|
|---|
| 8 | #ifndef QTMOLECULEITEM_NAME_HPP_
|
|---|
| 9 | #define QTMOLECULEITEM_NAME_HPP_
|
|---|
| 10 |
|
|---|
| 11 | // include config.h
|
|---|
| 12 | #ifdef HAVE_CONFIG_H
|
|---|
| 13 | #include <config.h>
|
|---|
| 14 | #endif
|
|---|
| 15 |
|
|---|
| 16 | #include "UIElements/Views/Qt4/MoleculeList/QtMoleculeItem.hpp"
|
|---|
| 17 |
|
|---|
| 18 | class QtMoleculeItemFactory;
|
|---|
| 19 |
|
|---|
| 20 | /** This class contains the name of a molecule and keeps it up to date.
|
|---|
| 21 | *
|
|---|
| 22 | */
|
|---|
| 23 | class QtMoleculeItem_name : public QtMoleculeItem
|
|---|
| 24 | {
|
|---|
| 25 | //!> only allow factory to instantiate items
|
|---|
| 26 | friend class QtMoleculeItemFactory;
|
|---|
| 27 |
|
|---|
| 28 | QtMoleculeItem_name(
|
|---|
| [7993fe] | 29 | QtObservedMolecule::ptr &_ObservedMolecule) :
|
|---|
| [3054f4a] | 30 | id(_ObservedMolecule->getIndex())
|
|---|
| [6d1e0a] | 31 | {
|
|---|
| 32 | // cannot call pure virtual function in QtMoleculeItem's cstor
|
|---|
| [b65879] | 33 | updateState(_ObservedMolecule);
|
|---|
| [6d1e0a] | 34 | }
|
|---|
| 35 |
|
|---|
| 36 | /** Performs the update of the molecule's name.
|
|---|
| 37 | *
|
|---|
| [b65879] | 38 | * \param _ObservedMolecule object to update state from
|
|---|
| [6d1e0a] | 39 | */
|
|---|
| [b65879] | 40 | void updateState(const QtObservedMolecule::ptr &_ObservedMolecule)
|
|---|
| [6d1e0a] | 41 | {
|
|---|
| [b65879] | 42 | setText(QString(_ObservedMolecule->getMolName().c_str()));
|
|---|
| [6d1e0a] | 43 | }
|
|---|
| 44 |
|
|---|
| [fcdf05] | 45 | QtMoleculeItem::COLUMNTYPES getType() const
|
|---|
| 46 | { return QtMoleculeItem::NAME; }
|
|---|
| [b65879] | 47 |
|
|---|
| 48 | /** Getter for the id of the observed molecule for this item.
|
|---|
| 49 | *
|
|---|
| 50 | * \return id of the observed molecule
|
|---|
| 51 | */
|
|---|
| [3054f4a] | 52 | ObservedValue_Index_t getMoleculeIndex() const
|
|---|
| [b65879] | 53 | { return id; }
|
|---|
| 54 |
|
|---|
| 55 | private:
|
|---|
| [3054f4a] | 56 | const ObservedValue_Index_t id;
|
|---|
| [6d1e0a] | 57 | };
|
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 | #endif /* QTMOLECULEITEM_NAME_HPP_ */
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.