Changeset 743eab for src/UIElements


Ignore:
Timestamp:
Apr 18, 2016, 10:33:41 PM (9 years ago)
Author:
Frederik Heber <heber@…>
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:
bff202
Parents:
b65879
git-author:
Frederik Heber <heber@…> (03/21/16 19:56:27)
git-committer:
Frederik Heber <heber@…> (04/18/16 22:33:41)
Message:

Added missing updateState() to QtMoleculeList.

Location:
src/UIElements/Views/Qt4/MoleculeList
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/Views/Qt4/MoleculeList/QtMoleculeList.cpp

    rb65879 r743eab  
    8787  connect(&observer, SIGNAL(NameChanged(const QtObservedMolecule::ptr)),
    8888      this, SLOT(nameChanged(const QtObservedMolecule::ptr)));
     89  connect(&observer, SIGNAL(AtomCountChanged(const QtObservedMolecule::ptr)),
     90      this, SLOT(atomcountChanged(const QtObservedMolecule::ptr)));
    8991  connect(board, SIGNAL(moleculeIndexChanged(const moleculeId_t,const moleculeId_t)),
    9092      this, SLOT(moleculeIndexChanged(const moleculeId_t, const moleculeId_t)));
     
    573575void QtMoleculeList::formulaChanged(const QtObservedMolecule::ptr _mol)
    574576{
    575   // we need the id as identifier to the items
     577  // we need the id as identifier to the item
    576578  const moleculeId_t molid = _mol->getMolIndex();
     579  LOG(3, "DEBUG: QtMoleculeList got formulaChanged for id " << molid);
     580  QtMoleculeItem *const molitem = MoleculeIdToItem(molid);
     581  // update item
     582  {
     583    QtMoleculeItem *const formulaitem = getSpecificMoleculeItem(molitem, QtMoleculeItem::FORMULA);
     584    ASSERT(formulaitem != NULL,
     585        "QtMoleculeList::formulaChanged() - could not item for FORMULA.");
     586    formulaitem->updateState(_mol);
     587  }
     588
    577589  LOG(3, "DEBUG: Moving item to id " << molid);
    578590  const MoleculeFormulaMap_t::iterator formulaiter =
     
    587599  // then we move the item if necessary
    588600  if (old_formula != new_formula) {
    589     QtMoleculeItem *const molitem = MoleculeIdToItem(molid);
    590     // update items
    591     getSpecificMoleculeItem(molitem, QtMoleculeItem::FORMULA)->updateState(_mol);
    592     getSpecificMoleculeItem(molitem, QtMoleculeItem::ATOMCOUNT)->updateState(_mol);
    593601    LOG(3, "DEBUG: Moving item " << molitem);
    594602    // remove from formula<->molecule bimap with old formula
     
    612620}
    613621
    614 void QtMoleculeList::nameChanged(const QtObservedMolecule::ptr _mol)
     622void QtMoleculeList::atomcountChanged(const QtObservedMolecule::ptr _mol)
    615623{
    616624  // we need the id as identifier to the items
    617625  const moleculeId_t molid = _mol->getMolIndex();
    618   // nothing to do, item updates itself
    619   LOG(3, "DEBUG: QtMoleculeList got nameChangd for id " << molid);
     626  LOG(3, "DEBUG: QtMoleculeList got atomcountChanged for id " << molid);
    620627  QtMoleculeItem *const molitem = MoleculeIdToItem(molid);
    621628  // update items
    622   getSpecificMoleculeItem(molitem, QtMoleculeItem::NAME)->updateState(_mol);
    623 }
     629  QtMoleculeItem *const atomcountitem = getSpecificMoleculeItem(molitem, QtMoleculeItem::ATOMCOUNT);
     630  ASSERT(atomcountitem != NULL,
     631      "QtMoleculeList::atomcountChanged() - could not item for ATOMCOUNT.");
     632  atomcountitem->updateState(_mol);
     633}
     634
     635void QtMoleculeList::nameChanged(const QtObservedMolecule::ptr _mol)
     636{
     637  // we need the id as identifier to the items
     638  const moleculeId_t molid = _mol->getMolIndex();
     639  LOG(3, "DEBUG: QtMoleculeList got nameChanged for id " << molid);
     640  QtMoleculeItem *const molitem = MoleculeIdToItem(molid);
     641  // update items
     642  QtMoleculeItem *const nameitem = getSpecificMoleculeItem(molitem, QtMoleculeItem::NAME);
     643  ASSERT(nameitem != NULL,
     644      "QtMoleculeList::nameChanged() - could not item for NAME.");
     645  nameitem->updateState(_mol);
     646}
  • src/UIElements/Views/Qt4/MoleculeList/QtMoleculeList.hpp

    rb65879 r743eab  
    5050  void formulaChanged(const QtObservedMolecule::ptr _mol);
    5151  void nameChanged(const QtObservedMolecule::ptr _mol);
     52  void atomcountChanged(const QtObservedMolecule::ptr _mol);
    5253
    5354  void moleculeNameChanged(QStandardItem*);
     
    5556
    5657signals:
    57   void moleculeSelected(const QtObservedMolecule::ptr _mol);
    58   void moleculeUnSelected(const QtObservedMolecule::ptr _mol);
    5958  void moleculesVisibilityChanged(const moleculeId_t, bool);
    60 
    61 private:
    6259
    6360private slots:
  • src/UIElements/Views/Qt4/MoleculeList/QtObservedMoleculeObserver.cpp

    rb65879 r743eab  
    5353void QtObservedMoleculeObserver::moleculeInserted(const QtObservedMolecule::ptr _molecule)
    5454{
     55  connect( _molecule.get(), SIGNAL(atomcountChanged()), this, SLOT(atomcountChanged()));
    5556  connect( _molecule.get(), SIGNAL(formulaChanged()), this, SLOT(formulaChanged()));
    5657  connect( _molecule.get(), SIGNAL(nameChanged()), this, SLOT(nameChanged()));
     58  connect( _molecule.get(), SIGNAL(selectedChanged()), this, SLOT(selectionChanged()));
    5759  emit MoleculeInserted(_molecule);
    5860}
     
    6163{
    6264  const QtObservedMolecule::ptr mol = board->getObservedMolecule(_moleculeid);
     65  disconnect( mol.get(), SIGNAL(atomcountChanged()), this, SLOT(atomcountChanged()));
    6366  disconnect( mol.get(), SIGNAL(formulaChanged()), this, SLOT(formulaChanged()));
    6467  disconnect( mol.get(), SIGNAL(nameChanged()), this, SLOT(nameChanged()));
     68  disconnect( mol.get(), SIGNAL(selectedChanged()), this, SLOT(selectionChanged()));
    6569  emit MoleculeRemoved(_moleculeid);
     70}
     71
     72void QtObservedMoleculeObserver::atomcountChanged()
     73{
     74  QtObservedMolecule * const mol = static_cast<QtObservedMolecule *>(sender());
     75  emit AtomCountChanged(mol->getRef());
    6676}
    6777
     
    7787  emit NameChanged(mol->getRef());
    7888}
     89
     90void QtObservedMoleculeObserver::selectionChanged()
     91{
     92  QtObservedMolecule * const mol = static_cast<QtObservedMolecule *>(sender());
     93  emit SelectionChanged(mol->getRef());
     94}
     95
  • src/UIElements/Views/Qt4/MoleculeList/QtObservedMoleculeObserver.hpp

    rb65879 r743eab  
    3838
    3939signals:
     40  void AtomCountChanged(const QtObservedMolecule::ptr _molecule);
    4041  void FormulaChanged(const QtObservedMolecule::ptr _molecule);
    4142  void NameChanged(const QtObservedMolecule::ptr _molecule);
     43  void SelectionChanged(const QtObservedMolecule::ptr _molecule);
    4244
    4345  // relayed signals
     
    4749private slots:
    4850  // relayed, and modified signals
     51  void atomcountChanged();
    4952  void formulaChanged();
    5053  void nameChanged();
     54  void selectionChanged();
    5155
    5256  void moleculeInserted(const QtObservedMolecule::ptr _molecule);
Note: See TracChangeset for help on using the changeset viewer.