Ignore:
Timestamp:
Aug 5, 2015, 5:32:11 PM (10 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:
a39d72
Parents:
e5a477
git-author:
Frederik Heber <heber@…> (07/19/15 07:08:38)
git-committer:
Frederik Heber <heber@…> (08/05/15 17:32:11)
Message:

QtMainWindow uses QtSelectionChangedAgent.

  • QtMoleculeListView and GLWorldView receive its signals. The latter passes it on to GLWorldScene.
  • QtMoleculeList has new MoleculeIdToIndex to allow QtMoleculeListView to (un)select specific rows on a given index.
  • GLWorldScene passes atom and molecule selection to GLMoleculeObject_molecule.
  • GLMoleculeObject_molecule passes atom selection to respective GLMoleculeObject_atom.
File:
1 edited

Legend:

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

    re5a477 r015f8c  
    2828 *      Author: ankele
    2929 */
    30 
    31 
    32 
    3330
    3431
     
    114111  TesselationHullUpdater(
    115112      boost::bind(&GLMoleculeObject_molecule::updateTesselationHull, this)
    116       ),
    117   IsSelectedUpdater(
    118       boost::bind(&GLMoleculeObject_molecule::updateIsSelected, this)
    119113      ),
    120114  BoundingBoxUpdater(
     
    135129      "MoleculeTesselationHull_"+toString(_molid),
    136130      HullChannels),
    137   isSelected(
    138       const_cast<const World * const>(World::getPointer()),
    139       IsSelectedUpdater,
    140       "MoleculeBoundingBox_"+toString(_molid),
    141       updateIsSelected(),
    142       BoundingBoxChannels),
    143131  BoundingBox(
    144132      molref,
     
    189177  TesselationHullUpdater(
    190178      boost::bind(&GLMoleculeObject_molecule::updateTesselationHull, this)
    191       ),
    192   IsSelectedUpdater(
    193       boost::bind(&GLMoleculeObject_molecule::updateIsSelected, this)
    194179      ),
    195180  BoundingBoxUpdater(
     
    210195      "MoleculeTesselationHull_"+toString(_molid),
    211196      HullChannels),
    212   isSelected(
    213       const_cast<const World * const>(World::getPointer()),
    214       IsSelectedUpdater,
    215       "MoleculeBoundingBox_"+toString(_molid),
    216       updateIsSelected(),
    217       BoundingBoxChannels),
    218197  BoundingBox(
    219198      molref,
     
    240219  connect (this, SIGNAL(TesselationHullChanged()), this, SLOT(resetTesselationHull()), Qt::QueuedConnection);
    241220  connect (this, SIGNAL(BoundingBoxChanged()), this, SLOT(resetBoundingBox()), Qt::QueuedConnection);
    242   connect (this, SIGNAL(IsSelectedChanged()), this, SLOT(resetIsSelected()), Qt::QueuedConnection);
    243221  connect (this, SIGNAL(IdChanged()), this, SLOT(resetIndex()), Qt::QueuedConnection);
    244222  connect (this, SIGNAL(AtomInserted(const atomId_t)), this, SLOT(atomInserted(const atomId_t)), Qt::QueuedConnection);
     
    262240    owner->signOff(this, molecule::AtomMoved);
    263241    owner->signOff(this, molecule::IndexChanged);
    264     /*_atom->signOff(this, AtomObservable::IndexChanged);
    265     _atom->signOff(this, AtomObservable::PositionChanged);
    266     _atom->signOff(this, AtomObservable::ElementChanged);
    267     _atom->signOff(this, AtomObservable::BondsAdded);*/
    268     World::getInstance().signOff(this, World::SelectionChanged);
    269242    owner = NULL;
    270243  }
     
    281254    owner->signOn(this, molecule::AtomMoved);
    282255    owner->signOn(this, molecule::IndexChanged);
    283     /*molref->signOn(this, AtomObservable::IndexChanged);
    284     molref->signOn(this, AtomObservable::PositionChanged);
    285     molref->signOn(this, AtomObservable::ElementChanged);
    286     molref->signOn(this, AtomObservable::BondsAdded);*/
    287     World::getInstance().signOn(this, World::SelectionChanged);
    288256  } else {
    289257    ELOG(1, "GLMoleculeObject_molecule() - added null object for not present mol id " << MolIndex.get());
     
    407375}
    408376
    409 bool GLMoleculeObject_molecule::updateIsSelected() const
    410 {
    411   return const_cast<const World &>(World::getInstance()).isMoleculeSelected(MolIndex.get());
    412 }
    413 
    414377GLMoleculeObject_molecule::BoundingBoxInfo GLMoleculeObject_molecule::updateBoundingBox() const
    415378{
     
    448411  if (!TesselationHull.isValid())
    449412    updateMesh(createMoleculeMesh(*TesselationHull));
    450 }
    451 
    452 void GLMoleculeObject_molecule::resetIsSelected()
    453 {
    454   setSelected(isSelected.get());
    455413}
    456414
     
    496454
    497455  emit indexChanged(this, oldId, newId);
     456}
     457
     458void GLMoleculeObject_molecule::AtomSelected(const atomId_t _id)
     459{
     460  AtomNodeMap::iterator iter = AtomsinSceneMap.find(_id);
     461  ASSERT( iter != AtomsinSceneMap.end(),
     462      "GLMoleculeObject_molecule::AtomSelected() - atom "+toString(_id)
     463      +" unknown to GLMoleculeObject_molecule.");
     464  QMetaObject::invokeMethod(iter->second,        // pointer to a QObject
     465                            "Selected",       // member name (no parameters here)
     466                            Qt::QueuedConnection);     // connection type
     467}
     468
     469void GLMoleculeObject_molecule::AtomUnselected(const atomId_t _id)
     470{
     471  AtomNodeMap::iterator iter = AtomsinSceneMap.find(_id);
     472  ASSERT( iter != AtomsinSceneMap.end(),
     473      "GLMoleculeObject_molecule::AtomUnselected() - atom "+toString(_id)
     474      +" unknown to GLMoleculeObject_molecule.");
     475  QMetaObject::invokeMethod(iter->second,        // pointer to a QObject
     476                            "Unselected",       // member name (no parameters here)
     477                            Qt::QueuedConnection);     // connection type
     478}
     479
     480void GLMoleculeObject_molecule::Selected()
     481{
     482  ASSERT( !m_selected,
     483      "GLMoleculeObject_molecule::Selected() - 3D rep of molecule is already selected.");
     484  m_selected = true;
     485
     486  emit changed();
     487}
     488
     489void GLMoleculeObject_molecule::Unselected()
     490{
     491  ASSERT( m_selected,
     492      "GLMoleculeObject_molecule::Unselected() - 3D rep of molecule is already unselected.");
     493  m_selected = false;
     494
     495  emit changed();
    498496}
    499497
     
    569567        break;
    570568    }
    571   }else{
    572     // notification from world
    573 #ifdef LOG_OBSERVER
    574     observerLog().addMessage() << "++ Update of Observer "<< observerLog().getName(static_cast<Observer *>(this))
    575           << " received notification from world for channel "
    576           << notification->getChannelNo() << ".";
    577 #endif
    578     switch (notification->getChannelNo()) {
    579       case World::SelectionChanged:
    580         emit IsSelectedChanged();
    581         break;
    582       default:
    583         break;
    584     }
    585   }
     569  } else
     570    ASSERT(0, "GLMoleculeObject_molecule::recieveNotification() - received notification from unexpected source.");
    586571}
    587572
     
    694679  connect (atomObject, SIGNAL(hoverChanged(GLMoleculeObject *)), this, SIGNAL(changed()));
    695680  connect (atomObject, SIGNAL(hoverChanged(GLMoleculeObject *)), this, SLOT(hoverChangedSignalled(GLMoleculeObject *)));
    696   connect (atomObject, SIGNAL(selectionChanged()), this, SIGNAL(changed()));
    697681//  connect (atomObject, SIGNAL(bondsChanged()), this, SLOT(bondInserted(const atomId_t, const atomId_t, const GLMoleculeObject_bond::SideOfBond)));
    698   connect (atomObject, SIGNAL(BondsInserted(const atomId_t, const atomId_t, const GLMoleculeObject_bond::SideOfBond)), this, SLOT(bondInserted(const atomId_t, const atomId_t, const GLMoleculeObject_bond::SideOfBond)));
     682  connect (atomObject, SIGNAL(BondsAdded(const atomId_t, const atomId_t, const GLMoleculeObject_bond::SideOfBond)), this, SLOT(bondInserted(const atomId_t, const atomId_t, const GLMoleculeObject_bond::SideOfBond)));
    699683  connect (atomObject, SIGNAL(BondsRemoved(const atomId_t, const atomId_t)), this, SLOT(bondRemoved(const atomId_t, const atomId_t)));
    700684  connect (atomObject, SIGNAL(indexChanged(GLMoleculeObject_atom*, const atomId_t, const atomId_t)), this, SLOT(changeAtomId(GLMoleculeObject_atom*, const atomId_t, const atomId_t)));
Note: See TracChangeset for help on using the changeset viewer.