source: src/UIElements/Views/Qt4/MoleculeList/QtMoleculeList.hpp@ 7f185f9

Action_Thermostats Add_AtomRandomPerturbation Add_FitFragmentPartialChargesAction Add_RotateAroundBondAction Add_SelectAtomByNameAction Added_ParseSaveFragmentResults AddingActions_SaveParseParticleParameters Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_ParticleName_to_Atom Adding_StructOpt_integration_tests AtomFragments Automaking_mpqc_open AutomationFragmentation_failures Candidate_v1.5.4 Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator CombiningParticlePotentialParsing Combining_Subpackages Debian_Package_split Debian_package_split_molecuildergui_only Disabling_MemDebug Docu_Python_wait EmpiricalPotential_contain_HomologyGraph EmpiricalPotential_contain_HomologyGraph_documentation Enable_parallel_make_install Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph FitPartialCharges_GlobalError Fix_BoundInBox_CenterInBox_MoleculeActions Fix_ChargeSampling_PBC Fix_ChronosMutex Fix_FitPartialCharges Fix_FitPotential_needs_atomicnumbers Fix_ForceAnnealing Fix_IndependentFragmentGrids Fix_ParseParticles Fix_ParseParticles_split_forward_backward_Actions Fix_PopActions Fix_QtFragmentList_sorted_selection Fix_Restrictedkeyset_FragmentMolecule Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns Fix_fitting_potentials Fixes ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion FragmentAction_writes_AtomFragments FragmentMolecule_checks_bonddegrees GeometryObjects Gui_Fixes Gui_displays_atomic_force_velocity ImplicitCharges IndependentFragmentGrids IndependentFragmentGrids_IndividualZeroInstances IndependentFragmentGrids_IntegrationTest IndependentFragmentGrids_Sole_NN_Calculation JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix MoreRobust_FragmentAutomation ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PdbParser_setsAtomName PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks Rewrite_FitPartialCharges RotateToPrincipalAxisSystem_UndoRedo SaturateAtoms_findBestMatching SaturateAtoms_singleDegree StoppableMakroAction Subpackage_CodePatterns Subpackage_JobMarket Subpackage_LinearAlgebra Subpackage_levmar Subpackage_mpqc_open Subpackage_vmg Switchable_LogView ThirdParty_MPQC_rebuilt_buildsystem TrajectoryDependenant_MaxOrder TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps TremoloParser_setsAtomName Ubuntu_1604_changes stable
Last change on this file since 7f185f9 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: 3.8 KB
RevLine 
[b47bfc]1/*
[0eb7bf3]2 * QtMoleculeList.hpp
[b47bfc]3 *
4 * Created on: Jan 21, 2010
5 * Author: crueger
6 */
7
[0eb7bf3]8#ifndef QTMOLECULELIST_HPP_
9#define QTMOLECULELIST_HPP_
[b47bfc]10
[56f73b]11// include config.h
12#ifdef HAVE_CONFIG_H
13#include <config.h>
14#endif
15
[53c1ff]16#include <QtGui/QItemSelection>
[8ccf3b]17#include <QtGui/QStandardItem>
18#include <QtGui/QStandardItemModel>
[53c1ff]19#include <QTimer>
[3eb91c]20
[8ccf3b]21#include <boost/bimap.hpp>
[fcdf05]22#include <boost/thread/recursive_mutex.hpp>
[3eb91c]23#include <map>
[53c1ff]24#include <set>
[3eb91c]25#include <string>
26
[53c1ff]27#include "UIElements/Views/Qt4/MoleculeList/QtMoleculeItem.hpp"
[5771e6]28#include "UIElements/Views/Qt4/MoleculeList/QtObservedMoleculeObserver.hpp"
[ca1535]29#include "UIElements/Qt4/InstanceBoard/QtObservedMolecule.hpp"
[53c1ff]30
[739ee9]31#include "types.hpp"
32
[53c1ff]33class QtMoleculeItem;
[f62e60]34class QtMoleculeListView;
[ca1535]35class QtObservedInstanceBoard;
[b47bfc]36
[ca1535]37class QtMoleculeList : public QStandardItemModel
[b47bfc]38{
39 Q_OBJECT
40
41public:
[b2c2e4]42 QtMoleculeList(QtObservedInstanceBoard *_board, QObject *_parent = NULL);
[0eb7bf3]43 virtual ~QtMoleculeList();
[b47bfc]44
[ca1535]45 void resetUpdateTimer();
[b47bfc]46
[1c3390]47 QVariant headerData(int section, Qt::Orientation orientation, int role) const;
48
[b47bfc]49private slots:
[5771e6]50 void formulaChanged(const QtObservedMolecule::ptr _mol);
51 void nameChanged(const QtObservedMolecule::ptr _mol);
[743eab]52 void atomcountChanged(const QtObservedMolecule::ptr _mol);
[5771e6]53
[07b800]54 void moleculeNameChanged(QStandardItem*);
[2696b1]55 void checkForVisibilityChange(QStandardItem*);
[b47bfc]56
57signals:
[3054f4a]58 void moleculesVisibilityChanged(ObservedValue_Index_t, bool);
[b47bfc]59
[ca1535]60private slots:
[1b07b1]61 void moleculeInserted(QtObservedMolecule::ptr _mol);
[3054f4a]62 void moleculeRemoved(ObservedValue_Index_t _id);
[ca1535]63
64private:
[f62e60]65 friend class QtMoleculeListView;
[8ccf3b]66
[3054f4a]67 bool isMoleculeItemPresent(ObservedValue_Index_t _id) const;
68 QtMoleculeItem * MoleculeIdToItem(ObservedValue_Index_t _id) const;
69 ObservedValue_Index_t ItemToMoleculeId(const QtMoleculeItem * const _item) const;
70 const QModelIndex MoleculeIdToIndex(ObservedValue_Index_t _id) const;
71 ObservedValue_Index_t IndexToMoleculeId(const QModelIndex &_index) const;
[fcdf05]72 QtMoleculeItem * getSpecificMoleculeItem(
73 const QtMoleculeItem * const _item,
74 const enum QtMoleculeItem::COLUMNTYPES _type) const;
75 bool isGroupItemPresent(const std::string &_formula) const;
76 const std::string& GroupItemToFormula(const QStandardItem * const _item) const;
77 QStandardItem * FormulaToGroupItem(const std::string &_formula) const;
78 QStandardItem * getSpecificGroupItem(
79 const QStandardItem * const _item,
80 const enum QtMoleculeItem::COLUMNTYPES _type) const;
81
[ca1535]82 std::string addMolecule(
83 QtObservedMolecule::ptr &_ObservedMolecule);
84 void addGroupItem(
85 QStandardItem *&mainitem,
86 const std::string &_molecule_formula);
87 QList<QStandardItem *> createMoleculeItems(
88 QtObservedMolecule::ptr &_ObservedMolecule,
89 std::string &molecule_formula);
[fcdf05]90 void removeMoleculeItem(QtMoleculeItem * const _item);
[53c1ff]91 int setOccurrence(QStandardItem * const _groupitem);
[2696b1]92 void setVisibilityForMoleculeItem(QtMoleculeItem* _item);
93 void setVisibilityForGroupItem(QStandardItem* _item);
[5771e6]94 void moveItem(QtMoleculeItem *_molitem, const std::string &_new_formula);
[53c1ff]95
[5771e6]96// void updateItemStates();
[6770fa]97
[ca1535]98 //!> reference to InstanceBoard
99 QtObservedInstanceBoard *board;
100
[3eb91c]101 typedef std::map<std::string, unsigned int> FormulaVisibilityCountMap_t;
102 FormulaVisibilityCountMap_t FormulaVisibilityCountMap;
103
[fcdf05]104 typedef boost::bimap<std::string, QStandardItem*> FormulaTreeItemBiMap_t;
105 //!> map of (unique) formulas in the world
106 FormulaTreeItemBiMap_t FormulaItemBiMap;
107
[3054f4a]108 typedef std::map<ObservedValue_Index_t, std::string> MoleculeFormulaMap_t;
[3eb91c]109 //!> map of (unique) formulas in the world
[fcdf05]110 MoleculeFormulaMap_t MoleculeFormulaMap;
[8ccf3b]111
[3054f4a]112 typedef boost::bimap<ObservedValue_Index_t, QtMoleculeItem*> MoleculeItemBiMap_t;
[8ccf3b]113 MoleculeItemBiMap_t MoleculeItemBiMap;
[53c1ff]114
[5771e6]115 //!> listens to all QtObservedMolecule and relays important events to us
116 QtObservedMoleculeObserver observer;
[b47bfc]117};
118
[0eb7bf3]119#endif /* QTMOLECULELIST_HPP_ */
Note: See TracBrowser for help on using the repository browser.