source: src/UIElements/Views/Qt4/MoleculeList/SpecificItems/QtMoleculeItem_formula.hpp

Candidate_v1.7.1 stable v1.7.1
Last change on this file was b65879, checked in by Frederik Heber <heber@…>, 10 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
RevLine 
[6d1e0a]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
20class QtMoleculeItemFactory;
21
22/** This class contains the formula of a molecule and keeps it up to date.
23 *
24 */
25class QtMoleculeItem_formula : public QtMoleculeItem
26{
27 //!> only allow factory to instantiate items
28 friend class QtMoleculeItemFactory;
29
30 QtMoleculeItem_formula(
[b65879]31 QtObservedMolecule::ptr &_ObservedMolecule)
[6d1e0a]32 {
33 // cannot call pure virtual function in QtMoleculeItem's cstor
[b65879]34 updateState(_ObservedMolecule);
[6d1e0a]35 }
36
37 /** Performs the update of the molecule's formula.
38 *
[b65879]39 * \param _ObservedMolecule object to update state from
[6d1e0a]40 */
[b65879]41 void updateState(const QtObservedMolecule::ptr &_ObservedMolecule)
[6d1e0a]42 {
[b65879]43 setText(QString(_ObservedMolecule->getMolFormula().c_str()));
[6d1e0a]44 }
45
[fcdf05]46 QtMoleculeItem::COLUMNTYPES getType() const
47 { return QtMoleculeItem::FORMULA; }
[6d1e0a]48};
49
50
51
52#endif /* QTMOLECULEITEM_FORMULA_HPP_ */
Note: See TracBrowser for help on using the repository browser.