Changeset 015f8c for src/UIElements/Views/Qt4/MoleculeList
- Timestamp:
- Aug 5, 2015, 5:32:11 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:
- a39d72
- Parents:
- e5a477
- git-author:
- Frederik Heber <heber@…> (07/19/15 07:08:38)
- git-committer:
- Frederik Heber <heber@…> (08/05/15 17:32:11)
- Location:
- src/UIElements/Views/Qt4/MoleculeList
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Views/Qt4/MoleculeList/QtMoleculeList.cpp
re5a477 r015f8c 178 178 } 179 179 180 const QModelIndex QtMoleculeList::MoleculeIdToIndex(const moleculeId_t _id) const 181 { 182 boost::recursive_mutex::scoped_lock lock(refill_mutex); 183 QtMoleculeItem * const item = MoleculeIdToItem(_id); 184 ASSERT(item != NULL, 185 "QtMoleculeList::MoleculeIdToIndex() - could not find item to " 186 +toString(_id)); 187 return indexFromItem(item); 188 } 180 189 181 190 const moleculeId_t QtMoleculeList::IndexToMoleculeId(const QModelIndex &_index) const -
src/UIElements/Views/Qt4/MoleculeList/QtMoleculeList.hpp
re5a477 r015f8c 86 86 bool isMoleculeItemPresent(const moleculeId_t _molid) const; 87 87 QtMoleculeItem * MoleculeIdToItem(const moleculeId_t _molid) const; 88 const moleculeId_t ItemToMoleculeId(const QtMoleculeItem * const _item) const; 89 const QModelIndex MoleculeIdToIndex(const moleculeId_t _id) const; 88 90 const moleculeId_t IndexToMoleculeId(const QModelIndex &_index) const; 89 const moleculeId_t ItemToMoleculeId(const QtMoleculeItem * const _item) const;90 91 QtMoleculeItem * getSpecificMoleculeItem( 91 92 const QtMoleculeItem * const _item, -
src/UIElements/Views/Qt4/MoleculeList/QtMoleculeListView.cpp
re5a477 r015f8c 37 37 #include "UIElements/Views/Qt4/MoleculeList/QtMoleculeList.hpp" 38 38 #include "UIElements/Views/Qt4/MoleculeList/QtMoleculeItem.hpp" 39 #include "UIElements/Views/Qt4/QtSelectionChangedAgent.hpp" 39 40 40 41 #include "CodePatterns/MemDebug.hpp" … … 53 54 { 54 55 setSelectionMode(QAbstractItemView::MultiSelection); 55 56 World::getInstance().signOn(this, World::SelectionChanged);57 56 } 58 57 59 58 QtMoleculeListView::~QtMoleculeListView() 60 { 61 World::getInstance().signOff(this, World::SelectionChanged); 62 } 59 {} 63 60 64 61 void QtMoleculeListView::setModel(QtMoleculeList *_moleculelist) … … 69 66 selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)), 70 67 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))); 71 77 } 72 78 … … 148 154 selecting = false; 149 155 } 156 157 void QtMoleculeListView::MoleculeSelected(const moleculeId_t _id) 158 { 159 if (selecting) 160 return; 161 162 selecting = true; 163 164 const QtMoleculeList *moleculelist = dynamic_cast<const QtMoleculeList *>(model()); 165 QModelIndex index = moleculelist->MoleculeIdToIndex(_id); 166 ASSERT( !selectionModel()->isSelected(index), 167 "QtMoleculeListView::MoleculeSelected() - row to molecule " 168 +toString(_id)+" is already selected."); 169 170 // select the full row 171 expand(index); 172 selectionModel()->select(index, QItemSelectionModel::Select | QItemSelectionModel::Rows); 173 174 selecting = false; 175 } 176 177 void QtMoleculeListView::MoleculeUnselected(const moleculeId_t _id) 178 { 179 if (selecting) 180 return; 181 182 selecting = true; 183 184 const QtMoleculeList *moleculelist = dynamic_cast<const QtMoleculeList *>(model()); 185 QModelIndex index = moleculelist->MoleculeIdToIndex(_id); 186 ASSERT( selectionModel()->isSelected(index), 187 "QtMoleculeListView::MoleculeSelected() - row to molecule " 188 +toString(_id)+" is already unselected."); 189 190 // unselect the full row 191 expand(index); 192 selectionModel()->select(index, QItemSelectionModel::Deselect | QItemSelectionModel::Rows); 193 194 selecting = false; 195 } 196 150 197 151 198 void QtMoleculeListView::recieveNotification(Observable *publisher, Notification_ptr notification) -
src/UIElements/Views/Qt4/MoleculeList/QtMoleculeListView.hpp
re5a477 r015f8c 19 19 #include "CodePatterns/Observer/Observer.hpp" 20 20 21 #include "types.hpp" 22 21 23 class QtMoleculeList; 24 class QtSelectionChangedAgent; 22 25 23 26 class QtMoleculeListView : public QTreeView, public Observer … … 31 34 void setModel(QtMoleculeList *_moleculelist); 32 35 36 void setSelectionChangedAgent(QtSelectionChangedAgent *agent); 37 33 38 public slots: 34 39 void rowsSelected(const QItemSelection&, const QItemSelection&); 40 41 void MoleculeSelected(const moleculeId_t _id); 42 void MoleculeUnselected(const moleculeId_t _id); 35 43 36 44 protected:
Note:
See TracChangeset
for help on using the changeset viewer.