- Timestamp:
- Jun 23, 2015, 6:29:02 AM (10 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:
- 6b474e
- Parents:
- 704d59
- git-author:
- Frederik Heber <heber@…> (05/22/15 21:14:50)
- git-committer:
- Frederik Heber <heber@…> (06/23/15 06:29:02)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Views/Qt4/MoleculeList/QtMoleculeList.cpp
r704d59 r69b434 102 102 } 103 103 104 QtMoleculeItem * QtMoleculeList::Molecule ToItem(const molecule * const _mol) const104 QtMoleculeItem * QtMoleculeList::MoleculeIdToItem(const moleculeId_t _molid) const 105 105 { 106 106 MoleculeItemBiMap_t::left_const_iterator iter = 107 MoleculeItemBiMap.left.find(_mol );107 MoleculeItemBiMap.left.find(_molid); 108 108 if( iter != MoleculeItemBiMap.left.end()) 109 109 return iter->second; … … 112 112 } 113 113 114 const molecule * const QtMoleculeList::ItemToMolecule(const QtMoleculeItem * const _item) const114 const moleculeId_t QtMoleculeList::ItemToMoleculeId(const QtMoleculeItem * const _item) const 115 115 { 116 116 const MoleculeItemBiMap_t::right_const_iterator iter = … … 119 119 return iter->second; 120 120 else 121 return NULL;122 } 123 124 const molecule * const QtMoleculeList::IndexToMolecule(const QModelIndex &_index) const121 return -1; 122 } 123 124 const moleculeId_t QtMoleculeList::IndexToMoleculeId(const QModelIndex &_index) const 125 125 { 126 126 QtMoleculeItem * const item = dynamic_cast<QtMoleculeItem *>(itemFromIndex(_index)); 127 127 if (item == NULL) 128 return NULL;128 return -1; 129 129 else 130 return ItemToMolecule (item);130 return ItemToMoleculeId(item); 131 131 } 132 132 … … 153 153 list_accessing = false; 154 154 155 const QtMoleculeItem *mol_item = Molecule ToItem(mol);155 const QtMoleculeItem *mol_item = MoleculeIdToItem(mol->getId()); 156 156 if (mol_item != NULL) { 157 157 QStandardItem *parent_item = mol_item->parent(); … … 194 194 void QtMoleculeList::addMoleculeItem( 195 195 QStandardItem *_groupitem, 196 const molecule * const _mol,196 const moleculeId_t _molid, 197 197 const std::string &_molecule_formula) 198 198 { 199 199 QList<QStandardItem *> molItems = 200 QtMoleculeItemFactory::getInstance().createMoleculeItems(_mol , callback_DirtyItems);200 QtMoleculeItemFactory::getInstance().createMoleculeItems(_molid, callback_DirtyItems); 201 201 QtMoleculeItem *mol_item = dynamic_cast<QtMoleculeItem *>(molItems.front()); 202 202 ASSERT( mol_item != NULL, 203 203 "QtMoleculeList::addMoleculeItem() - item from factory was not a QtMoleculeItem?"); 204 MoleculeItemBiMap.left.insert( std::make_pair(_mol , mol_item) );204 MoleculeItemBiMap.left.insert( std::make_pair(_molid, mol_item) ); 205 205 // LOG(1, "Inserting molecule " << _mol->getId() << ": " << _mol); 206 206 _groupitem->appendRow(molItems); … … 242 242 243 243 // add molecule 244 addMoleculeItem(groupItem, _mol , molecule_formula);244 addMoleculeItem(groupItem, _mol->getId(), molecule_formula); 245 245 } 246 246 … … 567 567 for (std::vector<const molecule *>::iterator removeiter = toBeRemovedItems_copy.begin(); 568 568 removeiter != toBeRemovedItems_copy.end(); ++removeiter) { 569 QtMoleculeItem *item = Molecule ToItem(*removeiter);569 QtMoleculeItem *item = MoleculeIdToItem((*removeiter)->getId()); 570 570 dirtyItems_copy.erase(item); 571 571 toBeMovedItems_copy.erase(item); … … 577 577 (*visiter)->index().row(), 578 578 QtMoleculeItemFactory::NAME)); 579 const molecule *mol = ItemToMolecule(_item); 579 const moleculeId_t molid = ItemToMoleculeId(_item); 580 const molecule *mol = World::getInstance().getMolecule(MoleculeById(molid)); 580 581 if (std::binary_search( 581 582 toBeRemovedItems_copy.begin(), toBeRemovedItems_copy.end(), … … 613 614 removeiter != toBeRemovedItems_copy.end(); ++removeiter) { 614 615 // LOG(1, "Removing molecule " << *removeiter); // cannot access directly, molecule is gone 615 QtMoleculeItem *item = Molecule ToItem(*removeiter);616 QtMoleculeItem *item = MoleculeIdToItem((*removeiter)->getId()); 616 617 if (item != NULL) 617 618 removeItem(item);
Note:
See TracChangeset
for help on using the changeset viewer.