Ignore:
Timestamp:
Apr 11, 2018, 6:29:57 AM (7 years ago)
Author:
Frederik Heber <frederik.heber@…>
Branches:
Candidate_v1.6.1, ChemicalSpaceEvaluator, Gui_displays_atomic_force_velocity, PythonUI_with_named_parameters, TremoloParser_IncreasedPrecision
Children:
e7ad08
Parents:
2c97ad
git-author:
Frederik Heber <frederik.heber@…> (08/09/17 18:00:22)
git-committer:
Frederik Heber <frederik.heber@…> (04/11/18 06:29:57)
Message:

FIX: GLWorldView no longer caught changes after deactivating DreiBein.

  • the logic relies now in sceneChangeSignalled, which is the changed() signal from the worlscene, and ChangeSignalled, which is the changed() from the worldview itself.
  • both use updateGL() to trigger a repaint, and have two different state variables to check whether the redraw is needed.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/Views/Qt4/Qt3D/GLWorldView.cpp

    r2c97ad r8819d2  
    9393//  connect(this, SIGNAL(TimeChanged()), worldscene, SIGNAL(updated()));
    9494  connect(worldscene, SIGNAL(changeOccured()), this, SLOT(changeSignalled()));
    95   connect(worldscene, SIGNAL(changed()), this, SIGNAL(changed()));
     95  connect(this, SIGNAL(changed()), this, SLOT(changeSignalled()));
    9696  connect(worldscene, SIGNAL(hoverChanged(const atomId_t)), this, SLOT(sceneHoverSignalled(const atomId_t)));
    9797  connect(worldscene, SIGNAL(hoverChanged(const moleculeId_t, int)), this, SLOT(sceneHoverSignalled(const moleculeId_t, int)));
    9898  //connect(this, SIGNAL(changed()), this, SLOT(updateGL()));
    99   connect(this, SIGNAL(changed()), this, SLOT(sceneChangeSignalled()));
     99  connect(worldscene, SIGNAL(changed()), this, SLOT(sceneChangeSignalled()));
    100100  connect(this, SIGNAL(moleculesVisibilityChanged(ObservedValue_Index_t,bool)),
    101101      worldscene, SLOT(moleculesVisibilityChanged(ObservedValue_Index_t,bool)));
     
    104104  WorldTime::getInstance().signOn(this, WorldTime::TimeChanged);
    105105  AtomObserver::getInstance().signOn(this, AtomObservable::PositionChanged);
     106  AtomObserver::getInstance().signOn(this, AtomObservable::VelocityChanged);
     107  AtomObserver::getInstance().signOn(this, AtomObservable::ForceChanged);
    106108
    107109  ShapeRegistry::getInstance().signOn(this);
     
    124126  WorldTime::getInstance().signOff(this, WorldTime::TimeChanged);
    125127  AtomObserver::getInstance().signOff(this, AtomObservable::PositionChanged);
     128  AtomObserver::getInstance().signOff(this, AtomObservable::VelocityChanged);
     129  AtomObserver::getInstance().signOff(this, AtomObservable::ForceChanged);
    126130  ShapeRegistry::getInstance().signOff(this);
    127131  ShapeRegistry::getInstance().signOff(this, ShapeRegistry::ShapeInserted);
     
    341345      observerLog().addMessage() << "++ Observer " << observerLog().getName(static_cast<Observer *>(this)) << " received notification that WorldTime's time has changed.";
    342346#endif
     347        needsRedraw = false;
    343348        emit changed();
    344349        emit TimeChanged();
     
    353358      case ShapeRegistry::ShapeInserted:
    354359      {
     360        needsRedraw = false;
    355361        emit ShapeAdded(ShapeRegistry::getInstance().lastChanged()->getName());
    356362        break;
     
    358364      case ShapeRegistry::ShapeRemoved:
    359365      {
     366        needsRedraw = false;
    360367        emit ShapeRemoved(ShapeRegistry::getInstance().lastChanged()->getName());
    361368        break;
     
    363370      case ShapeRegistry::SelectionChanged:
    364371      {
     372        needsRedraw = false;
    365373        worldscene->updateSelectedShapes();
    366374        break;
     
    375383void GLWorldView::checkChanges()
    376384{
     385  needsRedraw = false;
    377386  updateGL();
    378   needsRedraw = false;
    379387}
    380388
     
    385393  setdreiBeinStatus(!status);
    386394  // realize
    387   updateGL();
    388395  needsRedraw = true;
     396  emit changed();
    389397}
    390398
     
    403411  setDomainStatus(!status);
    404412  // realize
    405   updateGL();
    406413  needsRedraw = true;
     414  emit changed();
    407415}
    408416
     
    417425void GLWorldView::sceneChangeSignalled()
    418426{
    419   if (!needsRedraw){
     427  if (needsRedraw){
    420428    redrawTimer->singleShot(0, this, SLOT(checkChanges()));
    421429    needsRedraw = true;
     
    432440void GLWorldView::paintGL(QGLPainter *painter)
    433441{
    434   if (changesPresent) {
     442  if (changesPresent)
    435443    initializeGL(painter);
    436     changesPresent = false;
    437   }
    438444
    439445  QVector3D cameraDir = camera()->center() - camera()->eye();
     
    492498{
    493499  changesPresent = true;
     500  updateGL();
    494501}
    495502
     
    548555  setStereoType(QGLView::Hardware);
    549556  camera()->setEyeSeparation(0.0);
    550   updateGL();
     557  emit changed();
    551558}
    552559
     
    555562  setStereoType(QGLView::Hardware);
    556563  camera()->setEyeSeparation(defaultEyeSeparation);
    557   updateGL();
     564  emit changed();
    558565}
    559566
     
    562569  setStereoType(QGLView::LeftRight);
    563570  camera()->setEyeSeparation(defaultEyeSeparation);
    564   updateGL();
     571  emit changed();
    565572}
    566573
     
    569576  setStereoType(QGLView::RightLeft);
    570577  camera()->setEyeSeparation(defaultEyeSeparation);
    571   updateGL();
     578  emit changed();
    572579}
    573580
     
    576583  setStereoType(QGLView::TopBottom);
    577584  camera()->setEyeSeparation(defaultEyeSeparation);
    578   updateGL();
     585  emit changed();
    579586}
    580587
     
    583590  setStereoType(QGLView::BottomTop);
    584591  camera()->setEyeSeparation(defaultEyeSeparation);
    585   updateGL();
     592  emit changed();
    586593}
    587594
     
    590597  setStereoType(QGLView::RedCyanAnaglyph);
    591598  camera()->setEyeSeparation(defaultEyeSeparation);
    592   updateGL();
     599  emit changed();
    593600}
    594601
     
    714721void GLWorldView::sceneHoverSignalled(const atomId_t _id)
    715722{
     723  needsRedraw = true;
     724  emit changed();
    716725  emit hoverChanged(_id);
    717726}
     
    719728void GLWorldView::sceneHoverSignalled(const moleculeId_t _id, int _i)
    720729{
     730  needsRedraw = true;
     731  emit changed();
    721732  emit hoverChanged(_id, _i);
    722733}
Note: See TracChangeset for help on using the changeset viewer.