Changeset 0f368b for src/UIElements
- Timestamp:
- Feb 14, 2016, 12:33:43 PM (9 years ago)
- Branches:
- 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
- Children:
- b43585
- Parents:
- 5cd3a33
- git-author:
- Frederik Heber <heber@…> (12/28/15 19:14:32)
- git-committer:
- Frederik Heber <heber@…> (02/14/16 12:33:43)
- Location:
- src/UIElements
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Qt4/QtMainWindow.cpp
r5cd3a33 r0f368b 110 110 moleculeList = new QtMoleculeList(InstanceBoard, moleculeListView); 111 111 moleculeListView->setModel(moleculeList); 112 moleculeListView->setSelectionChangedAgent(selectionagent);113 112 114 113 elementList = new QtElementList(worldTab); -
src/UIElements/Views/Qt4/MoleculeList/QtMoleculeListView.cpp
r5cd3a33 r0f368b 35 35 #include "QtMoleculeListView.hpp" 36 36 37 #include <QtCore/QMetaType> 38 37 39 #include "UIElements/Views/Qt4/MoleculeList/QtMoleculeList.hpp" 38 40 #include "UIElements/Views/Qt4/MoleculeList/QtMoleculeItem.hpp" 39 #include "UIElements/Views/Qt4/QtSelectionChangedAgent.hpp"40 41 41 42 #include "CodePatterns/MemDebug.hpp" … … 45 46 #include "Actions/SelectionAction/Molecules/MoleculeByIdAction.hpp" 46 47 #include "Actions/SelectionAction/Molecules/NotMoleculeByIdAction.hpp" 47 48 #include "MoleculeObserver.hpp" 49 #include "molecule.hpp" 48 50 #include "World.hpp" 49 51 … … 54 56 { 55 57 setSelectionMode(QAbstractItemView::MultiSelection); 58 59 qRegisterMetaType<QItemSelection>("QItemSelection"); 60 61 MoleculeObserver::getInstance().signOn(this, molecule::SelectionChanged); 56 62 } 57 63 58 64 QtMoleculeListView::~QtMoleculeListView() 59 {} 65 { 66 MoleculeObserver::getInstance().signOff(this, molecule::SelectionChanged); 67 } 60 68 61 69 void QtMoleculeListView::setModel(QtMoleculeList *_moleculelist) … … 66 74 selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)), 67 75 this, SLOT(rowsSelected(const QItemSelection &, const QItemSelection &)), Qt::DirectConnection); 68 }69 70 71 void QtMoleculeListView::setSelectionChangedAgent(QtSelectionChangedAgent *agent)72 {73 connect(agent, SIGNAL(moleculeSelected(const moleculeId_t)),74 this, SLOT(MoleculeSelected(const moleculeId_t)));75 connect(agent, SIGNAL(moleculeUnselected(const moleculeId_t)),76 this, SLOT(MoleculeUnselected(const moleculeId_t)));77 76 } 78 77 … … 243 242 } 244 243 default: 245 ASSERT(0, "QtMoleculeListView::recieveNotification() - cannot get here, not subscribed to channel "244 ASSERT(0, "QtMoleculeListView::recieveNotification() - cannot get here, not subscribed to World's channel " 246 245 +toString(notification->getChannelNo())); 247 246 break; 248 247 } 248 } else if (dynamic_cast<molecule*>(publisher) != NULL) { 249 const molecule * const mol = dynamic_cast<molecule *>(publisher); 250 switch (notification->getChannelNo()) { 251 case molecule::SelectionChanged: 252 { 253 if (mol->getSelected()) 254 MoleculeSelected(mol->getId()); 255 else 256 MoleculeUnselected(mol->getId()); 257 break; 258 } 259 default: 260 ASSERT(0, "QtMoleculeListView::recieveNotification() - cannot get here, not subscribed to mol's channel " 261 +toString(notification->getChannelNo())); 262 break; 263 } 264 } else { 265 ASSERT(0, 266 "QtMoleculeListView::recieveNotification() - cannot get here, unknown publisher "+toString(publisher)); 249 267 } 250 268 } -
src/UIElements/Views/Qt4/MoleculeList/QtMoleculeListView.hpp
r5cd3a33 r0f368b 22 22 23 23 class QtMoleculeList; 24 class QtSelectionChangedAgent;25 24 26 25 class QtMoleculeListView : public QTreeView, public Observer … … 34 33 void setModel(QtMoleculeList *_moleculelist); 35 34 36 void setSelectionChangedAgent(QtSelectionChangedAgent *agent);37 38 35 public slots: 39 36 void rowsSelected(const QItemSelection&, const QItemSelection&); 40 41 void MoleculeSelected(const moleculeId_t _id);42 void MoleculeUnselected(const moleculeId_t _id);43 37 44 38 protected: … … 48 42 49 43 private: 44 void MoleculeSelected(const moleculeId_t _id); 45 void MoleculeUnselected(const moleculeId_t _id); 46 50 47 QModelIndex setIndexToLastColumn(const QModelIndex &_index) const; 51 48
Note:
See TracChangeset
for help on using the changeset viewer.