Candidate_v1.6.1
Last change
on this file was 3054f4a, checked in by Frederik Heber <heber@…>, 9 years ago |
QtObserved...Observed now get index on ...Removed() signal.
|
-
Property mode
set to
100644
|
File size:
1.3 KB
|
Line | |
---|
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(
|
---|
29 | QtObservedMolecule::ptr &_ObservedMolecule) :
|
---|
30 | id(_ObservedMolecule->getIndex())
|
---|
31 | {
|
---|
32 | // cannot call pure virtual function in QtMoleculeItem's cstor
|
---|
33 | updateState(_ObservedMolecule);
|
---|
34 | }
|
---|
35 |
|
---|
36 | /** Performs the update of the molecule's name.
|
---|
37 | *
|
---|
38 | * \param _ObservedMolecule object to update state from
|
---|
39 | */
|
---|
40 | void updateState(const QtObservedMolecule::ptr &_ObservedMolecule)
|
---|
41 | {
|
---|
42 | setText(QString(_ObservedMolecule->getMolName().c_str()));
|
---|
43 | }
|
---|
44 |
|
---|
45 | QtMoleculeItem::COLUMNTYPES getType() const
|
---|
46 | { return QtMoleculeItem::NAME; }
|
---|
47 |
|
---|
48 | /** Getter for the id of the observed molecule for this item.
|
---|
49 | *
|
---|
50 | * \return id of the observed molecule
|
---|
51 | */
|
---|
52 | ObservedValue_Index_t getMoleculeIndex() const
|
---|
53 | { return id; }
|
---|
54 |
|
---|
55 | private:
|
---|
56 | const ObservedValue_Index_t id;
|
---|
57 | };
|
---|
58 |
|
---|
59 |
|
---|
60 | #endif /* QTMOLECULEITEM_NAME_HPP_ */
|
---|
Note:
See
TracBrowser
for help on using the repository browser.