Changeset 4dfe724


Ignore:
Timestamp:
Jul 3, 2017, 3:00:00 PM (7 years ago)
Author:
Frederik Heber <frederik.heber@…>
Branches:
Action_Thermostats, Add_SelectAtomByNameAction, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_StructOpt_integration_tests, AutomationFragmentation_failures, Candidate_v1.6.1, ChemicalSpaceEvaluator, EmpiricalPotential_contain_HomologyGraph_documentation, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, Fix_Verbose_Codepatterns, ForceAnnealing_oldresults, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, Gui_displays_atomic_force_velocity, IndependentFragmentGrids_IntegrationTest, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, StoppableMakroAction, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps
Children:
f1cacb
Parents:
70fee0
git-author:
Frederik Heber <heber@…> (04/07/17 17:49:31)
git-committer:
Frederik Heber <frederik.heber@…> (07/03/17 15:00:00)
Message:

FIX: QtGui again reacts to WorldTime changes.

  • QtObservedAtom now observes WorldTime and uses new forceUpdate() for position and molecule ObservedValues to get information of new time step.
  • Note: As WorldTime is a singleton living till the end of the program we do not need any fancy taking care of subjectKilled() in a correct manner.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/Qt4/InstanceBoard/QtObservedAtom.cpp

    r70fee0 r4dfe724  
    4747#include "Element/element.hpp"
    4848#include "World.hpp"
     49#include "WorldTime.hpp"
    4950
    5051#include "UIElements/Qt4/InstanceBoard/ObservedValue_wCallback.hpp"
     
    264265{
    265266  // ObservedValues have been updated before, hence convert updates to Qt's signals
    266   switch (notification->getChannelNo()) {
    267     case AtomObservable::IndexChanged:
    268     {
    269       emit indexChanged();
    270       break;
     267  if (publisher == WorldTime::getPointer()) {
     268    // force update of all changes that may occur from one time step to another
     269    boost::any_cast<ObservedValue_wCallback<Vector, ObservedValue_Index_t> *>(
     270        ObservedValues[AtomPosition])->forceUpdate();
     271    boost::any_cast<ObservedValue_wCallback<QtObservedMolecule*, ObservedValue_Index_t> *>(
     272        ObservedValues[MoleculeRef])->forceUpdate();
     273    // then tell Qt part about updates
     274    emit positionChanged();
     275    emit moleculeChanged();
     276  } else {
     277    switch (notification->getChannelNo()) {
     278      case AtomObservable::IndexChanged:
     279      {
     280        emit indexChanged();
     281        break;
     282      }
     283      case AtomObservable::BondsAdded:
     284      case AtomObservable::BondsRemoved:
     285        emit bondsChanged();
     286        break;
     287      case AtomObservable::ElementChanged:
     288        emit elementChanged();
     289        break;
     290      case AtomObservable::MoleculeChanged:
     291        emit moleculeChanged();
     292        break;
     293      case AtomObservable::NameChanged:
     294        emit nameChanged();
     295        break;
     296      case AtomObservable::PositionChanged:
     297        emit positionChanged();
     298        break;
     299      case AtomObservable::SelectionChanged:
     300        emit selectedChanged();
     301        break;
     302      default:
     303        ASSERT(0, "QtObservedAtom::recieveNotification() - we are not signed on to channel "
     304            +toString(notification->getChannelNo())+" of the atom.");
     305        break;
    271306    }
    272     case AtomObservable::BondsAdded:
    273     case AtomObservable::BondsRemoved:
    274       emit bondsChanged();
    275       break;
    276     case AtomObservable::ElementChanged:
    277       emit elementChanged();
    278       break;
    279     case AtomObservable::MoleculeChanged:
    280       emit moleculeChanged();
    281       break;
    282     case AtomObservable::NameChanged:
    283       emit nameChanged();
    284       break;
    285     case AtomObservable::PositionChanged:
    286       emit positionChanged();
    287       break;
    288     case AtomObservable::SelectionChanged:
    289       emit selectedChanged();
    290       break;
    291     default:
    292       ASSERT(0, "QtObservedAtom::recieveNotification() - we are not signed on to channel "
    293           +toString(notification->getChannelNo())+" of the atom.");
    294       break;
    295307  }
    296308}
     
    309321  } else
    310322    signedOffChannels = AllsignedOnChannels;
     323
     324  WorldTime::getInstance().signOn(this, WorldTime::TimeChanged);
    311325}
    312326
     
    324338      board.markObservedAtomAsDisconnected(getIndex());
    325339  }
     340
     341  WorldTime::getInstance().signOff(this, WorldTime::TimeChanged);
    326342}
    327343
Note: See TracChangeset for help on using the changeset viewer.