source: src/UIElements/Views/Qt4/MoleculeList/QtMoleculeList.hpp@ 6b474e

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 6b474e was 69b434, checked in by Frederik Heber <heber@…>, 10 years ago

QtMoleculeItem now uses moleculeId_t instead molecule*.

  • Property mode set to 100644
File size: 3.9 KB
Line 
1/*
2 * QtMoleculeList.hpp
3 *
4 * Created on: Jan 21, 2010
5 * Author: crueger
6 */
7
8#ifndef QTMOLECULELIST_HPP_
9#define QTMOLECULELIST_HPP_
10
11// include config.h
12#ifdef HAVE_CONFIG_H
13#include <config.h>
14#endif
15
16#include <QtGui/QItemSelection>
17#include <QtGui/QStandardItem>
18#include <QtGui/QStandardItemModel>
19#include <QTimer>
20
21#include <boost/bimap.hpp>
22#include <map>
23#include <set>
24#include <string>
25
26#include "CodePatterns/Observer/Observer.hpp"
27
28#include "UIElements/Views/Qt4/MoleculeList/QtMoleculeItem.hpp"
29
30#include "types.hpp"
31
32class molecule;
33class MoleculeListClass;
34class QtMoleculeItem;
35class QtMoleculeListView;
36
37class QtMoleculeList : public QStandardItemModel, public Observer
38{
39 Q_OBJECT
40
41public:
42 QtMoleculeList();
43 virtual ~QtMoleculeList();
44
45protected:
46 virtual void update(Observable *publisher);
47 virtual void recieveNotification(Observable *publisher, Notification_ptr notification);
48 virtual void subjectKilled(Observable *publisher);
49
50 void refill();
51
52 QVariant headerData(int section, Qt::Orientation orientation, int role) const;
53
54private slots:
55 void moleculeChanged();
56// void visibilityChanged(QStandardItem*, int);
57 void checkForVisibilityChange(QStandardItem*);
58 void checkState();
59
60 friend class QtMoleculeItem;
61
62 void readdItem(QtMoleculeItem *_molitem);
63
64signals:
65 void moleculeSelected(molecule*);
66 void moleculeUnSelected(molecule*);
67 void moleculesVisibilityChanged(const moleculeId_t, bool);
68
69private:
70
71 bool changing;
72 bool ChangingChildrensVisibility;
73 bool list_accessing;
74
75 //!> informs the view in regular intervals about updates
76 QTimer *update_timer;
77
78 //!> how often per second update is signalled to view
79 static const unsigned int update_times_per_second;
80
81 friend class QtMoleculeListView;
82
83 QtMoleculeItem * MoleculeIdToItem(const moleculeId_t _molid) const;
84 const moleculeId_t IndexToMoleculeId(const QModelIndex &_index) const;
85 const moleculeId_t ItemToMoleculeId(const QtMoleculeItem * const _item) const;
86
87 void addMolecule(const molecule * const _mol);
88 void addGroupItem(QStandardItem *&mainitem, const std::string &_molecule_formula);
89 void addMoleculeItem(QStandardItem *_groupitem, const moleculeId_t _molid, const std::string &molecule_formula);
90 void removeItem(QtMoleculeItem * const _item);
91 int setOccurrence(QStandardItem * const _groupitem);
92 bool areAnyItemsDirty();
93 void addToBeSetOccurrence(QStandardItem *_groupitem);
94 void setVisibilityForMoleculeItem(QtMoleculeItem* _item);
95 void setVisibilityForGroupItem(QStandardItem* _item);
96
97 void informDirtyState(QtMoleculeItem *_item, const QtMoleculeItem::MoveTypes _type);
98
99 void updateItemStates();
100
101 typedef std::map<std::string, unsigned int> FormulaVisibilityCountMap_t;
102 FormulaVisibilityCountMap_t FormulaVisibilityCountMap;
103
104 typedef std::map<std::string, QStandardItem*> FormulaTreeItemMap_t;
105 //!> map of (unique) formulas in the world
106 FormulaTreeItemMap_t formula;
107
108 typedef boost::bimap<moleculeId_t, QtMoleculeItem*> MoleculeItemBiMap_t;
109 MoleculeItemBiMap_t MoleculeItemBiMap;
110
111 //!> callback function to hand over to items that inform about requiring update
112 const QtMoleculeItem::emitDirtyState_t callback_DirtyItems;
113
114 typedef std::set<QtMoleculeItem*> list_of_items_t;
115 //!> list of items that need an update
116 list_of_items_t dirtyItems;
117 //!> list of items that need an update of visibility
118 list_of_items_t visibilityItems;
119 //!> list of items to molecule's whose formulas has changed and need to be moved
120 list_of_items_t toBeMovedItems;
121 //!> list of items to new molecules which need to be added
122 std::vector<const molecule *> newItems;
123 //!> list of items to molecules that have been removed
124 std::vector<const molecule *> toBeRemovedItems;
125 //!> list of group items that need update due to moved molecule items
126 std::set<QStandardItem*> toBeSetOccurrenceItems;
127 //!> list of group items that need visibility update due to changed molecule items
128 std::set<QStandardItem*> toBeSetVisibilityItems;
129};
130
131#endif /* QTMOLECULELIST_HPP_ */
Note: See TracBrowser for help on using the repository browser.