Changeset 7993fe for src/UIElements


Ignore:
Timestamp:
Mar 24, 2016, 2:58:04 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:
24eb6b
Parents:
924259
git-author:
Frederik Heber <heber@…> (03/18/16 09:39:37)
git-committer:
Frederik Heber <heber@…> (03/24/16 14:58:04)
Message:

Removed emitDirtyState callback from QtMoleculeItem.

  • this does not seem to be needed any longer, probably since introduction of QtObservedMolecule.
Location:
src/UIElements/Views/Qt4/MoleculeList
Files:
13 edited

Legend:

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

    r924259 r7993fe  
    4141QtMoleculeItem::QtMoleculeItem(
    4242    QtObservedMolecule::ptr &_ObservedMolecule,
    43      const enum MoveTypes _movetype,
    44      const emitDirtyState_t _emitDirtyState) :
     43     const enum MoveTypes _movetype) :
    4544  ObservedMolecule(_ObservedMolecule),
    4645  movetype(_movetype),
    47   dirty(true),
    48   emitDirtyState(_emitDirtyState)
     46  dirty(true)
    4947{
    5048  setFlags(flags() | Qt::ItemIsSelectable);
  • src/UIElements/Views/Qt4/MoleculeList/QtMoleculeItem.hpp

    r924259 r7993fe  
    4747  enum COLUMNTYPES {NAME,VISIBILITY,ATOMCOUNT,FORMULA,OCCURRENCE,COLUMNTYPES_MAX};
    4848
    49   //!> typedef for callback function to model to inform when we need update
    50   typedef const boost::function<void (
    51       const moleculeId_t _id,
    52       const QtMoleculeItem::COLUMNTYPES _type,
    53       const enum MoveTypes)> emitDirtyState_t;
    54 
    5549  QtMoleculeItem(
    5650      QtObservedMolecule::ptr &_ObservedMolecule,
    57       const enum MoveTypes _movetype,
    58       const emitDirtyState_t _emitDirtyState);
     51      const enum MoveTypes _movetype);
    5952  virtual ~QtMoleculeItem();
    6053
     
    9992  //!> states that this item needs to be updated
    10093  bool dirty;
    101 
    102   //!> bound callback function to inform model about change
    103   const emitDirtyState_t emitDirtyState;
    10494};
    10595
  • src/UIElements/Views/Qt4/MoleculeList/QtMoleculeItemFactory.cpp

    r924259 r7993fe  
    6161QList<QStandardItem *>
    6262QtMoleculeItemFactory::createMoleculeItems(
    63     QtObservedMolecule::ptr &_ObservedMolecule,
    64     const QtMoleculeItem::emitDirtyState_t &_emitDirtyState)
     63    QtObservedMolecule::ptr &_ObservedMolecule)
    6564{
    6665  QList<QStandardItem *> molItems;
    67   molItems << new QtMoleculeItem_name(_ObservedMolecule, _emitDirtyState);
    68   molItems << new QtMoleculeItem_visibility(_ObservedMolecule, _emitDirtyState);
    69   molItems << new QtMoleculeItem_atomcount(_ObservedMolecule, _emitDirtyState);
    70   molItems << new QtMoleculeItem_formula(_ObservedMolecule, _emitDirtyState);
    71   molItems << new QtMoleculeItem_occurrence(_ObservedMolecule, _emitDirtyState);
     66  molItems << new QtMoleculeItem_name(_ObservedMolecule);
     67  molItems << new QtMoleculeItem_visibility(_ObservedMolecule);
     68  molItems << new QtMoleculeItem_atomcount(_ObservedMolecule);
     69  molItems << new QtMoleculeItem_formula(_ObservedMolecule);
     70  molItems << new QtMoleculeItem_occurrence(_ObservedMolecule);
    7271  return molItems;
    7372}
  • src/UIElements/Views/Qt4/MoleculeList/QtMoleculeItemFactory.hpp

    r924259 r7993fe  
    4646   *
    4747   * \param _ObservedMolecule observed representation of the molecule
    48    * \param _emitDirtyState callback function to model to inform about required state update
    4948   * \return list of prepared items to be appended to a group item
    5049   */
    5150  QList<QStandardItem *> createMoleculeItems(
    52       QtObservedMolecule::ptr &_ObservedMolecule,
    53       const QtMoleculeItem::emitDirtyState_t &_emitDirtyState);
     51      QtObservedMolecule::ptr &_ObservedMolecule);
    5452
    5553  /** Creates all QtMoleculeItem's that make up a row of a group item.
  • src/UIElements/Views/Qt4/MoleculeList/QtMoleculeList.cpp

    r924259 r7993fe  
    7373  QStandardItemModel(_parent),
    7474  update_timer(NULL),
    75   board(_board),
    76   callback_DirtyItems(boost::bind(&QtMoleculeList::informDirtyState, this, _1, _2, _3))
     75  board(_board)
    7776{
    7877  setColumnCount(QtMoleculeItemFactory::COLUMNCOUNT);
     
    313312{
    314313  QList<QStandardItem *> molItems =
    315       QtMoleculeItemFactory::getInstance().createMoleculeItems(
    316           _ObservedMolecule,
    317           callback_DirtyItems);
     314      QtMoleculeItemFactory::getInstance().createMoleculeItems(_ObservedMolecule);
    318315  QtMoleculeItem *mol_item = dynamic_cast<QtMoleculeItem *>(molItems.front());
    319316  ASSERT( mol_item != NULL,
  • src/UIElements/Views/Qt4/MoleculeList/QtMoleculeList.hpp

    r924259 r7993fe  
    135135  MoleculeItemBiMap_t MoleculeItemBiMap;
    136136
    137   //!> callback function to hand over to items that inform about requiring update
    138   const QtMoleculeItem::emitDirtyState_t callback_DirtyItems;
    139 
    140137  typedef std::map<moleculeId_t, unsigned int> KilledItemsPerMolecule_t;
    141138  //!> takes note of how many items have already been killed for a specific row/molecule
  • src/UIElements/Views/Qt4/MoleculeList/QtObservedMoleculeObserver.cpp

    r924259 r7993fe  
    4242    QtObservedInstanceBoard *_board,
    4343    QWidget * _parent) :
    44     QWidget(_parent)
     44    QWidget(_parent),
     45    board(_board)
    4546{
    4647    connect(_board, SIGNAL(moleculeInserted(QtObservedMolecule::ptr)),
    47         this, SIGNAL(MoleculeInserted(QtObservedMolecule::ptr)));
     48        this, SLOT(moleculeInserted(QtObservedMolecule::ptr)));
    4849    connect(_board, SIGNAL(moleculeRemoved(const moleculeId_t)),
    49         this, SIGNAL(MoleculeRemoved(const moleculeId_t)));
     50        this, SLOT(moleculeRemoved(const moleculeId_t)));
     51}
     52
     53void QtObservedMoleculeObserver::moleculeInserted(const QtObservedMolecule::ptr _molecule)
     54{
     55  connect( _molecule.get(), SIGNAL(formulaChanged()), this, SLOT(formulaChanged()));
     56  connect( _molecule.get(), SIGNAL(nameChanged()), this, SLOT(nameChanged()));
     57  emit MoleculeInserted(_molecule);
     58}
     59
     60void QtObservedMoleculeObserver::moleculeRemoved(const moleculeId_t _moleculeid)
     61{
     62  const QtObservedMolecule::ptr mol = board->getObservedMolecule(_moleculeid);
     63  disconnect( mol.get(), SIGNAL(formulaChanged()), this, SLOT(formulaChanged()));
     64  disconnect( mol.get(), SIGNAL(nameChanged()), this, SLOT(nameChanged()));
     65  emit MoleculeRemoved(_moleculeid);
    5066}
    5167
    5268void QtObservedMoleculeObserver::formulaChanged()
    5369{
    54   QtObservedMolecule * const walker = static_cast<QtObservedMolecule *>(sender());
    55   emit FormulaChanged(walker->getRef());
     70  QtObservedMolecule * const mol = static_cast<QtObservedMolecule *>(sender());
     71  emit FormulaChanged(mol->getRef());
    5672}
    5773
    5874void QtObservedMoleculeObserver::nameChanged()
    5975{
    60   QtObservedMolecule * const walker = static_cast<QtObservedMolecule *>(sender());
    61   emit NameChanged(walker->getRef());
     76  QtObservedMolecule * const mol = static_cast<QtObservedMolecule *>(sender());
     77  emit NameChanged(mol->getRef());
    6278}
  • src/UIElements/Views/Qt4/MoleculeList/QtObservedMoleculeObserver.hpp

    r924259 r7993fe  
    3838
    3939signals:
    40   void FormulaChanged(const QtObservedMolecule::ptr _atom);
    41   void NameChanged(const QtObservedMolecule::ptr _atom);
     40  void FormulaChanged(const QtObservedMolecule::ptr _molecule);
     41  void NameChanged(const QtObservedMolecule::ptr _molecule);
    4242
    4343  // relayed signals
    44   void MoleculeInserted(const QtObservedMolecule::ptr _atom);
    45   void MoleculeRemoved(const atomId_t _atomid);
     44  void MoleculeInserted(const QtObservedMolecule::ptr _molecule);
     45  void MoleculeRemoved(const moleculeId_t _molid);
    4646
    4747private slots:
     
    5050  void nameChanged();
    5151
     52  void moleculeInserted(const QtObservedMolecule::ptr _molecule);
     53  void moleculeRemoved(const moleculeId_t _molid);
     54
     55private:
     56  //!> ref to get object from index
     57  QtObservedInstanceBoard * const board;
    5258};
    5359
  • src/UIElements/Views/Qt4/MoleculeList/SpecificItems/QtMoleculeItem_atomcount.hpp

    r924259 r7993fe  
    2727
    2828  QtMoleculeItem_atomcount(
    29       QtObservedMolecule::ptr &_ObservedMolecule,
    30       const emitDirtyState_t &_emitDirtyState) :
    31         QtMoleculeItem(_ObservedMolecule, QtMoleculeItem::NeedsMove, _emitDirtyState)
     29      QtObservedMolecule::ptr &_ObservedMolecule) :
     30        QtMoleculeItem(_ObservedMolecule, QtMoleculeItem::NeedsMove)
    3231  {
    3332    // cannot call pure virtual function in QtMoleculeItem's cstor
  • src/UIElements/Views/Qt4/MoleculeList/SpecificItems/QtMoleculeItem_formula.hpp

    r924259 r7993fe  
    2929
    3030  QtMoleculeItem_formula(
    31       QtObservedMolecule::ptr &_ObservedMolecule,
    32       const emitDirtyState_t &_emitDirtyState) :
    33         QtMoleculeItem(_ObservedMolecule, QtMoleculeItem::NeedsMove, _emitDirtyState)
     31      QtObservedMolecule::ptr &_ObservedMolecule) :
     32        QtMoleculeItem(_ObservedMolecule, QtMoleculeItem::NeedsMove)
    3433  {
    3534    // cannot call pure virtual function in QtMoleculeItem's cstor
  • src/UIElements/Views/Qt4/MoleculeList/SpecificItems/QtMoleculeItem_name.hpp

    r924259 r7993fe  
    2727
    2828  QtMoleculeItem_name(
    29       QtObservedMolecule::ptr &_ObservedMolecule,
    30       const emitDirtyState_t &_emitDirtyState) :
    31         QtMoleculeItem(_ObservedMolecule, QtMoleculeItem::DoesNotMove, _emitDirtyState)
     29      QtObservedMolecule::ptr &_ObservedMolecule) :
     30        QtMoleculeItem(_ObservedMolecule, QtMoleculeItem::DoesNotMove)
    3231  {
    3332    // cannot call pure virtual function in QtMoleculeItem's cstor
  • src/UIElements/Views/Qt4/MoleculeList/SpecificItems/QtMoleculeItem_occurrence.hpp

    r924259 r7993fe  
    2727
    2828  QtMoleculeItem_occurrence(
    29       QtObservedMolecule::ptr &_ObservedMolecule,
    30       const emitDirtyState_t &_emitDirtyState) :
    31         QtMoleculeItem(_ObservedMolecule, QtMoleculeItem::DoesNotMove, _emitDirtyState)
     29      QtObservedMolecule::ptr &_ObservedMolecule) :
     30        QtMoleculeItem(_ObservedMolecule, QtMoleculeItem::DoesNotMove)
    3231  {
    3332    // cannot call pure virtual function in QtMoleculeItem's cstor
  • src/UIElements/Views/Qt4/MoleculeList/SpecificItems/QtMoleculeItem_visibility.hpp

    r924259 r7993fe  
    2727
    2828  QtMoleculeItem_visibility(
    29       QtObservedMolecule::ptr &_ObservedMolecule,
    30       const emitDirtyState_t &_emitDirtyState) :
    31         QtMoleculeItem(_ObservedMolecule, QtMoleculeItem::DoesNotMove, _emitDirtyState)
     29      QtObservedMolecule::ptr &_ObservedMolecule) :
     30        QtMoleculeItem(_ObservedMolecule, QtMoleculeItem::DoesNotMove)
    3231  {
    3332    setFlags(flags() | Qt::ItemIsUserCheckable);
Note: See TracChangeset for help on using the changeset viewer.