Candidate_v1.6.1
Last change
on this file was b65879, checked in by Frederik Heber <heber@…>, 9 years ago |
QtMoleculeItems do not store ObservedMolecule::ptr any longer.
- it is given as parameter in updateState().
- in the cstor they only get it to initiate the item text properly.
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | /*
|
---|
2 | * QtMoleculeItem_formula.hpp
|
---|
3 | *
|
---|
4 | * Created on: Jan 18, 2015
|
---|
5 | * Author: heber
|
---|
6 | */
|
---|
7 |
|
---|
8 | #ifndef QTMOLECULEITEM_FORMULA_HPP_
|
---|
9 | #define QTMOLECULEITEM_FORMULA_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 | #include <string>
|
---|
19 |
|
---|
20 | class QtMoleculeItemFactory;
|
---|
21 |
|
---|
22 | /** This class contains the formula of a molecule and keeps it up to date.
|
---|
23 | *
|
---|
24 | */
|
---|
25 | class QtMoleculeItem_formula : public QtMoleculeItem
|
---|
26 | {
|
---|
27 | //!> only allow factory to instantiate items
|
---|
28 | friend class QtMoleculeItemFactory;
|
---|
29 |
|
---|
30 | QtMoleculeItem_formula(
|
---|
31 | QtObservedMolecule::ptr &_ObservedMolecule)
|
---|
32 | {
|
---|
33 | // cannot call pure virtual function in QtMoleculeItem's cstor
|
---|
34 | updateState(_ObservedMolecule);
|
---|
35 | }
|
---|
36 |
|
---|
37 | /** Performs the update of the molecule's formula.
|
---|
38 | *
|
---|
39 | * \param _ObservedMolecule object to update state from
|
---|
40 | */
|
---|
41 | void updateState(const QtObservedMolecule::ptr &_ObservedMolecule)
|
---|
42 | {
|
---|
43 | setText(QString(_ObservedMolecule->getMolFormula().c_str()));
|
---|
44 | }
|
---|
45 |
|
---|
46 | QtMoleculeItem::COLUMNTYPES getType() const
|
---|
47 | { return QtMoleculeItem::FORMULA; }
|
---|
48 | };
|
---|
49 |
|
---|
50 |
|
---|
51 |
|
---|
52 | #endif /* QTMOLECULEITEM_FORMULA_HPP_ */
|
---|
Note:
See
TracBrowser
for help on using the repository browser.