Changeset 3c9ac3 for src/UIElements


Ignore:
Timestamp:
Jul 12, 2017, 7:12:47 PM (7 years ago)
Author:
Frederik Heber <frederik.heber@…>
Branches:
Action_Thermostats, Adding_MD_integration_tests, Adding_StructOpt_integration_tests, AutomationFragmentation_failures, Candidate_v1.6.1, ChemicalSpaceEvaluator, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Exclude_Hydrogens_annealWithBondGraph, Fix_Verbose_Codepatterns, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, Gui_displays_atomic_force_velocity, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, PythonUI_with_named_parameters, Recreated_GuiChecks, StoppableMakroAction, TremoloParser_IncreasedPrecision
Children:
9a1e099
Parents:
4c6f0d
git-author:
Frederik Heber <frederik.heber@…> (07/12/17 14:34:42)
git-committer:
Frederik Heber <frederik.heber@…> (07/12/17 19:12:47)
Message:

Qt..Lists now take note of subjectKilled propery.

Location:
src/UIElements/Views/Qt4
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/Views/Qt4/QtGeometryList.cpp

    r4c6f0d r3c9ac3  
    5454QtGeometryList::QtGeometryList(QWidget * _parent) :
    5555    QTreeWidget (_parent),
    56     Observer("QtGeometryList")
     56    Observer("QtGeometryList"),
     57    geometryregistry_enabled(false)
    5758{
    5859  setColumnCount(COLUMNCOUNT);
     
    7374        GeometryRegistry::getInstance().signOn(this, GeometryRegistry::GeometryInserted);
    7475        GeometryRegistry::getInstance().signOn(this, GeometryRegistry::GeometryRemoved);
     76        geometryregistry_enabled = true;
    7577
    7678        QCoreApplication::instance()->installEventFilter(this);
     
    7981QtGeometryList::~QtGeometryList()
    8082{
    81   GeometryRegistry::getInstance().signOff(this);
    82   GeometryRegistry::getInstance().signOff(this, GeometryRegistry::GeometryInserted);
    83   GeometryRegistry::getInstance().signOff(this, GeometryRegistry::GeometryRemoved);
     83  if (geometryregistry_enabled) {
     84    GeometryRegistry::getInstance().signOff(this);
     85    GeometryRegistry::getInstance().signOff(this, GeometryRegistry::GeometryInserted);
     86    GeometryRegistry::getInstance().signOff(this, GeometryRegistry::GeometryRemoved);
     87  }
     88}
     89
     90void QtGeometryList::subjectKilled(Observable *publisher)
     91{
     92  // as a new instance should always already be present ... just sign on
     93  if (static_cast<GeometryRegistry *>(publisher) == GeometryRegistry::getPointer()) {
     94    geometryregistry_enabled = false;
     95  }
    8496}
    8597
     
    133145    refill(NULL);*/
    134146  QTreeWidget::paintEvent(event);
    135 }
    136 
    137 void QtGeometryList::subjectKilled(Observable *publisher) {
    138147}
    139148
  • src/UIElements/Views/Qt4/QtGeometryList.hpp

    r4c6f0d r3c9ac3  
    4848
    4949private:
     50  //!> flag to indicate that we are signed on to GeometryRegistry
     51  bool geometryregistry_enabled;
    5052
    5153  mutable boost::recursive_mutex refill_mutex;
  • src/UIElements/Views/Qt4/QtHomologyList.cpp

    r4c6f0d r3c9ac3  
    7878    QWidget(_parent),
    7979    Observer("QtHomologyList"),
     80    homologycontainer_enabled(false),
    8081    potentialregistry_enabled(false)
    8182{
     
    118119        HomologyContainer &homologies = World::getInstance().getHomologies();
    119120        homologies.signOn(this);
     121        homologycontainer_enabled = true;
    120122        PotentialRegistry::getInstance().signOn(this);
    121123        potentialregistry_enabled = true;
     
    144146
    145147
    146   HomologyContainer &homologies = World::getInstance().getHomologies();
    147   homologies.signOff(this);
     148  if (homologycontainer_enabled) {
     149    HomologyContainer &homologies = World::getInstance().getHomologies();
     150    homologies.signOff(this);
     151  }
    148152  if (potentialregistry_enabled)
    149153    PotentialRegistry::getInstance().signOff(this);
     
    304308  if (static_cast<PotentialRegistry *>(publisher) == PotentialRegistry::getPointer()) {
    305309    potentialregistry_enabled = false;
    306   } else {
    307     // its HomologyContainer
     310  } else if (static_cast<HomologyContainer *>(publisher) == &World::getInstance().getHomologies()) {
     311    homologycontainer_enabled = false;
    308312  }
    309313}
  • src/UIElements/Views/Qt4/QtHomologyList.hpp

    r4c6f0d r3c9ac3  
    5555  //!> flag to indicate that we got an update
    5656  bool dirty;
     57  //!> flag to indicate whether we are subscribed to HomologyContainer
     58  bool homologycontainer_enabled;
    5759  //!> flag to indicate whether we are subscribed to PotentialRegistry
    5860  bool potentialregistry_enabled;
  • src/UIElements/Views/Qt4/QtShapeList.cpp

    r4c6f0d r3c9ac3  
    5555QtShapeList::QtShapeList(QWidget * _parent) :
    5656    QTreeWidget (_parent),
    57     Observer("QtShapeList")
     57    Observer("QtShapeList"),
     58    shaperegistry_enabled(false)
    5859{
    5960  setColumnCount(COLUMNCOUNT);
     
    7374  ShapeRegistry::getInstance().signOn(this, ShapeRegistry::ShapeRemoved);
    7475  ShapeRegistry::getInstance().signOn(this, ShapeRegistry::SelectionChanged);
     76  shaperegistry_enabled = true;
    7577
    7678  connect(this,SIGNAL(itemSelectionChanged()),this,SLOT(rowSelected()));
     
    7981QtShapeList::~QtShapeList()
    8082{
    81   ShapeRegistry::getInstance().signOff(this);
    82   ShapeRegistry::getInstance().signOff(this, ShapeRegistry::ShapeInserted);
    83   ShapeRegistry::getInstance().signOff(this, ShapeRegistry::ShapeRemoved);
    84   ShapeRegistry::getInstance().signOff(this, ShapeRegistry::SelectionChanged);
     83  if (shaperegistry_enabled) {
     84    ShapeRegistry::getInstance().signOff(this);
     85    ShapeRegistry::getInstance().signOff(this, ShapeRegistry::ShapeInserted);
     86    ShapeRegistry::getInstance().signOff(this, ShapeRegistry::ShapeRemoved);
     87    ShapeRegistry::getInstance().signOff(this, ShapeRegistry::SelectionChanged);
     88  }
    8589}
    8690
     
    148152}
    149153
    150 void QtShapeList::subjectKilled(Observable *publisher) {
     154void QtShapeList::subjectKilled(Observable *publisher)
     155{
     156  // as a new instance should always already be present ... just sign on
     157  if (static_cast<ShapeRegistry *>(publisher) == ShapeRegistry::getPointer()) {
     158    shaperegistry_enabled = false;
     159  }
    151160}
    152 
    153161
    154162void QtShapeList::rowSelected()
  • src/UIElements/Views/Qt4/QtShapeList.hpp

    r4c6f0d r3c9ac3  
    5454  std::vector<bool> shapeSelection; //!< needed to determine when a selection changes
    5555
     56  //!> flag to indicate whether we are signed on
     57  bool shaperegistry_enabled;
     58
    5659  mutable boost::recursive_mutex refill_mutex;
    5760};
Note: See TracChangeset for help on using the changeset viewer.