Changeset 5cd3a33 for src/UIElements


Ignore:
Timestamp:
Feb 14, 2016, 12:33:43 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:
0f368b
Parents:
9e9100
git-author:
Frederik Heber <heber@…> (12/28/15 17:12:08)
git-committer:
Frederik Heber <heber@…> (02/14/16 12:33:43)
Message:

Removed QtSelectionUsage in GLWorldView and related.

  • instead GLMoleculeObject_.. directly use observedvalue to get notified when they have been (un)selected.
Location:
src/UIElements
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/Qt4/QtMainWindow.cpp

    r9e9100 r5cd3a33  
    126126//  glWorldView->setFocus();
    127127  glWorldView->camera()->setEye( QVector3D(0,3,10));
    128   glWorldView->setSelectionChangedAgent(selectionagent);
    129128
    130129  MainMenu = new QtMenu<QMenuBar>(menuBar(), "");
  • src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_atom.cpp

    r9e9100 r5cd3a33  
    7878  connect( ObservedAtom.get(), SIGNAL(positionChanged()), this, SLOT(resetPosition()));
    7979  connect( ObservedAtom.get(), SIGNAL(bondsChanged()), this, SLOT(resetPosition()));
     80  connect( ObservedAtom.get(), SIGNAL(selectedChanged()), this, SLOT(resetSelected()));
    8081
    8182  // use that ObservedValues::AtomBonds is always up-to-date
     
    162163}
    163164
    164 void GLMoleculeObject_atom::Selected()
     165void GLMoleculeObject_atom::resetSelected()
    165166{
    166   ASSERT( !m_selected,
    167       "GLMoleculeObject_atom::Selected() - 3D rep of atom is already selected.");
    168   m_selected = true;
     167  const bool new_selected = ObservedAtom->getAtomSelected();
     168  ASSERT( m_selected != new_selected,
     169      "GLMoleculeObject_atom::resetSelected() - new and old selection state are the same.");
     170  m_selected = new_selected;
    169171
    170172  emit changed();
    171173}
    172 
    173 void GLMoleculeObject_atom::Unselected()
    174 {
    175   ASSERT( m_selected,
    176       "GLMoleculeObject_atom::Unselected() - 3D rep of atom is already unselected.");
    177   m_selected = false;
    178 
    179   emit changed();
    180 }
    181 
    182174
    183175void GLMoleculeObject_atom::draw(QGLPainter *painter, const QVector4D &cameraPlane)
  • src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_atom.hpp

    r9e9100 r5cd3a33  
    4141  void draw(QGLPainter *painter, const QVector4D &cameraPlane);
    4242
    43 public slots:
    44   void Selected();
    45   void Unselected();
    46 
    4743private slots:
    4844  void wasClicked();
     
    5147  void resetPosition();
    5248  void resetBonds();
     49  void resetSelected();
    5350
    5451signals:
  • src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.cpp

    r9e9100 r5cd3a33  
    151151  connect (ObservedMolecule.get(), SIGNAL(atomInserted(const atomId_t)), this, SLOT(atomInserted(const atomId_t)));
    152152  connect (ObservedMolecule.get(), SIGNAL(atomRemoved(const atomId_t)), this, SLOT(atomRemoved(const atomId_t)));
     153  connect (ObservedMolecule.get(), SIGNAL(selectedChanged()), this, SLOT(resetSelected()));
    153154
    154155  connect( this, SIGNAL(clicked()), this, SLOT(wasClicked()));
     
    280281}
    281282
    282 void GLMoleculeObject_molecule::AtomSelected(const atomId_t _id)
    283 {
    284   AtomNodeMap::iterator iter = AtomsinSceneMap.find(_id);
    285   if (iter != AtomsinSceneMap.end())
    286     QMetaObject::invokeMethod(iter->second,        // pointer to a QObject
    287                             "Selected",       // member name (no parameters here)
    288                             Qt::QueuedConnection);     // connection type
    289   else
    290     ELOG(2, "GLMoleculeObject_molecule::AtomSelected() - atom "
    291         << _id << " unknown to GLMoleculeObject_molecule.");
    292 }
    293 
    294 void GLMoleculeObject_molecule::AtomUnselected(const atomId_t _id)
    295 {
    296   AtomNodeMap::iterator iter = AtomsinSceneMap.find(_id);
    297   if (iter != AtomsinSceneMap.end())
    298     QMetaObject::invokeMethod(iter->second,        // pointer to a QObject
    299                             "Unselected",       // member name (no parameters here)
    300                             Qt::QueuedConnection);     // connection type
    301   else ELOG(2,  "GLMoleculeObject_molecule::AtomUnselected() - atom "
    302       << _id << " unknown to GLMoleculeObject_molecule.");
    303 }
    304 
    305 void GLMoleculeObject_molecule::Selected()
    306 {
    307   ASSERT( !m_selected,
    308       "GLMoleculeObject_molecule::Selected() - 3D rep of molecule is already selected.");
    309   m_selected = true;
     283void GLMoleculeObject_molecule::resetSelected()
     284{
     285  const bool new_selected = ObservedMolecule->getMolSelected();
     286  ASSERT( m_selected != new_selected,
     287      "GLMoleculeObject_molecule::resetSelected() - new and old selection state are the same.");
     288  m_selected = new_selected;
    310289
    311290  emit changed();
    312291}
    313 
    314 void GLMoleculeObject_molecule::Unselected()
    315 {
    316   ASSERT( m_selected,
    317       "GLMoleculeObject_molecule::Unselected() - 3D rep of molecule is already unselected.");
    318   m_selected = false;
    319 
    320   emit changed();
    321 }
    322 
    323292
    324293void GLMoleculeObject_molecule::initialize(QGLView *view, QGLPainter *painter)
  • src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.hpp

    r9e9100 r5cd3a33  
    9090  void resetBoundingBox();
    9191  void resetIndex();
    92 
    93   void AtomSelected(const atomId_t _id);
    94   void AtomUnselected(const atomId_t _id);
    95   void Selected();
    96   void Unselected();
     92  void resetSelected();
    9793
    9894private:
  • src/UIElements/Views/Qt4/Qt3D/GLWorldScene.cpp

    r9e9100 r5cd3a33  
    5050
    5151#include "UIElements/Qt4/InstanceBoard/QtObservedInstanceBoard.hpp"
    52 #include "UIElements/Views/Qt4/QtSelectionChangedAgent.hpp"
    5352
    5453#include "CodePatterns/MemDebug.hpp"
     
    438437}
    439438
    440 void GLWorldScene::setSelectionChangedAgent(QtSelectionChangedAgent *agent)
    441 {
    442   connect(agent, SIGNAL(atomSelected(const moleculeId_t, const atomId_t)),
    443       this, SLOT(AtomSelected(const moleculeId_t, const atomId_t)));
    444   connect(agent, SIGNAL(atomUnselected(const moleculeId_t, const atomId_t)),
    445       this, SLOT(AtomUnselected(const moleculeId_t, const atomId_t)));
    446 
    447   connect(agent, SIGNAL(moleculeSelected(const moleculeId_t)),
    448       this, SLOT(MoleculeSelected(const moleculeId_t)));
    449   connect(agent, SIGNAL(moleculeUnselected(const moleculeId_t)),
    450       this, SLOT(MoleculeUnselected(const moleculeId_t)));
    451 }
    452 
    453439void GLWorldScene::setSelectionModeAtom()
    454440{
     
    500486}
    501487
    502 void GLWorldScene::AtomSelected(const moleculeId_t _molid, const atomId_t _id)
    503 {
    504   boost::recursive_mutex::scoped_lock lock(MoleculeinSceneMap_mutex);
    505   MoleculeNodeMap::iterator iter = MoleculesinSceneMap.find(_molid);
    506   // use direct connection as it's lightweight and we avoid index change troubles
    507   if (iter != MoleculesinSceneMap.end())
    508     QMetaObject::invokeMethod(iter->second,        // pointer to a QObject
    509                             "AtomSelected",       // member name (no parameters here)
    510                             Qt::DirectConnection,     // connection type
    511                             Q_ARG(const atomId_t, _id));     // parameters
    512   else
    513     ELOG(2, "DEBUG: GLWorldScene::AtomSelected() - molecule " <<
    514         _molid << " unknown to GLWorldScene.");
    515 }
    516 
    517 void GLWorldScene::AtomUnselected(const moleculeId_t _molid, const atomId_t _id)
    518 {
    519   boost::recursive_mutex::scoped_lock lock(MoleculeinSceneMap_mutex);
    520   MoleculeNodeMap::iterator iter = MoleculesinSceneMap.find(_molid);
    521   // use direct connection as it's lightweight and we avoid index change troubles
    522   if (iter != MoleculesinSceneMap.end())
    523     QMetaObject::invokeMethod(iter->second,        // pointer to a QObject
    524                             "AtomUnselected",       // member name (no parameters here)
    525                             Qt::DirectConnection,     // connection type
    526                             Q_ARG(const atomId_t, _id));     // parameters
    527   else
    528     ELOG(2, "GLWorldScene::AtomUnselected() - molecule "
    529         << _molid << " unknown to GLWorldScene.");
    530 }
    531 
    532 void GLWorldScene::MoleculeSelected(const moleculeId_t _molid)
    533 {
    534   boost::recursive_mutex::scoped_lock lock(MoleculeinSceneMap_mutex);
    535 MoleculeNodeMap::iterator iter = MoleculesinSceneMap.find(_molid);
    536   if (iter != MoleculesinSceneMap.end())
    537     QMetaObject::invokeMethod(iter->second,        // pointer to a QObject
    538                             "Selected",       // member name (no parameters here)
    539                             Qt::QueuedConnection);     // connection type
    540   else
    541     ELOG(2, "GLWorldScene::MoleculeSelected() - molecule "
    542         << _molid << " unknown to GLWorldScene.");
    543 }
    544 
    545 void GLWorldScene::MoleculeUnselected(const moleculeId_t _molid)
    546 {
    547   boost::recursive_mutex::scoped_lock lock(MoleculeinSceneMap_mutex);
    548   MoleculeNodeMap::iterator iter = MoleculesinSceneMap.find(_molid);
    549   if (iter != MoleculesinSceneMap.end())
    550     QMetaObject::invokeMethod(iter->second,        // pointer to a QObject
    551                             "Unselected",       // member name (no parameters here)
    552                             Qt::QueuedConnection);     // connection type
    553   else
    554     ELOG(2, "GLWorldScene::MoleculeUnselected() - molecule "
    555         << _molid << " unknown to GLWorldScene.");
    556 }
  • src/UIElements/Views/Qt4/Qt3D/GLWorldScene.hpp

    r9e9100 r5cd3a33  
    3939class GLMoleculeObject_molecule;
    4040class GLMoleculeObject_shape;
    41 class QtSelectionChangedAgent;
    4241
    4342class QtObservedInstanceBoard;
     
    7372  void setSelectionMode(SelectionModeType mode);
    7473
    75   void setSelectionChangedAgent(QtSelectionChangedAgent *agent);
    76 
    7774signals:
    7875  void changed();
     
    10299  void moleculesVisibilityChanged(const moleculeId_t _id, bool _visible);
    103100  void changeMoleculeId(GLMoleculeObject_molecule *, const moleculeId_t, const moleculeId_t);
    104 
    105   void AtomSelected(const moleculeId_t _molid, const atomId_t);
    106   void AtomUnselected(const moleculeId_t _molid, const atomId_t);
    107   void MoleculeSelected(const moleculeId_t);
    108   void MoleculeUnselected(const moleculeId_t);
    109101
    110102public:
  • src/UIElements/Views/Qt4/Qt3D/GLWorldView.cpp

    r9e9100 r5cd3a33  
    313313}
    314314
    315 void GLWorldView::setSelectionChangedAgent(QtSelectionChangedAgent *agent)
    316 {
    317   worldscene->setSelectionChangedAgent(agent);
    318 }
    319 
    320315/**
    321316 * Update operation which can be invoked by the observable (which should be the
  • src/UIElements/Views/Qt4/Qt3D/GLWorldView.hpp

    r9e9100 r5cd3a33  
    2626class QToolBar;
    2727class QTimer;
    28 class QtSelectionChangedAgent;
    2928
    3029class QtObservedInstanceBoard;
     
    4645  void createDomainBox();
    4746  void createDreiBein();
    48 
    49   void setSelectionChangedAgent(QtSelectionChangedAgent *agent);
    5047
    5148  // Observer functions
Note: See TracChangeset for help on using the changeset viewer.