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

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_atomcount.hpp
3 *
4 * Created on: Jan 18, 2015
5 * Author: heber
6 */
7
8#ifndef QTMOLECULEITEM_ATOMCOUNT_HPP_
9#define QTMOLECULEITEM_ATOMCOUNT_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
18class QtMoleculeItemFactory;
19
20/** This class contains the atomcount of a molecule and keeps it up to date.
21 *
22 */
23class QtMoleculeItem_atomcount : public QtMoleculeItem
24{
25 //!> only allow factory to instantiate items
26 friend class QtMoleculeItemFactory;
27
28 QtMoleculeItem_atomcount(
29 QtObservedMolecule::ptr &_ObservedMolecule)
30 {
31 // cannot call pure virtual function in QtMoleculeItem's cstor
32 updateState(_ObservedMolecule);
33 }
34
35 /** Performs the update of the molecule's atomcount.
36 *
37 * \param _ObservedMolecule object to update state from
38 */
39 void updateState(const QtObservedMolecule::ptr &_ObservedMolecule)
40 {
41 setText(QString::number(_ObservedMolecule->getAtomCount()));
42 }
43
44 QtMoleculeItem::COLUMNTYPES getType() const
45 { return QtMoleculeItem::ATOMCOUNT; }
46};
47
48
49
50#endif /* QTMOLECULEITEM_ATOMCOUNT_HPP_ */
Note: See TracBrowser for help on using the repository browser.