/* * QtMoleculeItem.hpp * * Created on: Jan 17, 2015 * Author: heber */ #ifndef QTMOLECULEITEM_HPP_ #define QTMOLECULEITEM_HPP_ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include #include "UIElements/Qt4/InstanceBoard/QtObservedMolecule.hpp" /** This class describes the general interface for a specific item in a QtAbstractItemModel * to contain a specific piece of information about a specific molecule. * * To this end, we need a ref to the molecule for updating the information when * necessary and we need to know the channels we have to listen to know when an * update is necessary. * * This class takes care of of all the rest: * -# informing QtMoleculeList about required update ("dirty") * -# relaying updateState() call from QtMoleculeList to the specific internal_updateState() */ class QtMoleculeItem : public QStandardItem { public: //!> enumerates all different item types, coinciding with column in QtMoleculeList enum COLUMNTYPES {NAME,VISIBILITY,ATOMCOUNT,FORMULA,OCCURRENCE,COLUMNTYPES_MAX}; QtMoleculeItem(); virtual ~QtMoleculeItem(); /** Update the state of this item. * * \param _ObservedMolecule object to update state from */ virtual void updateState(const QtObservedMolecule::ptr &_ObservedMolecule) = 0; /** Returns the type of this QtMoleculeItem, i.e. the column in QtMoleculeList. * * @return type of this item */ virtual QtMoleculeItem::COLUMNTYPES getType() const = 0; /** Getter for the id of the observed molecule for this item. * * \return id of the observed molecule */ virtual const moleculeId_t getMoleculeId() const { return -1; } }; #endif /* QTMOLECULEITEM_HPP_ */