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_atom.cpp

    re5a477 r015f8c  
    7575const Observable::channels_t
    7676GLMoleculeObject_atom::AtomBondsChannels(getAtomBondsChannels());
    77 const Observable::channels_t
    78 GLMoleculeObject_atom::AtomSelectionStatusChannels(World::SelectionChanged);
    7977
    8078GLMoleculeObject_atom::GLMoleculeObject_atom(QGLSceneNode *mesh[], QObject *parent, const atomId_t _id) :
     
    106104      updateBonds(),
    107105      AtomBondsChannels),
    108   AtomSelectionStatus(
    109       World::getPointer(),
    110       boost::bind(&GLMoleculeObject_atom::updateSelectionStatus, this),
    111       "AtomSelectionStatus_"+toString(_id),
    112       updateSelectionStatus(),
    113       AtomSelectionStatusChannels),
    114106  owner(NULL)
    115107{
     
    129121  connect( this, SIGNAL(positionChanged()), this, SLOT(resetPosition()), Qt::QueuedConnection);
    130122  connect( this, SIGNAL(bondsChanged()), this, SLOT(resetPosition()), Qt::QueuedConnection);
    131   connect( this, SIGNAL(selectionstatusChanged()), this, SLOT(resetSelectionStatus()), Qt::QueuedConnection);
    132123}
    133124
     
    141132    owner->signOn(this, AtomObservable::BondsAdded);
    142133    owner->signOn(this, AtomObservable::BondsRemoved);
    143     World::getInstance().signOn(this, World::SelectionChanged);
    144134  }
    145135}
     
    155145    owner->signOff(this, AtomObservable::BondsAdded);
    156146    owner->signOff(this, AtomObservable::BondsRemoved);
    157     World::getInstance().signOff(this, World::SelectionChanged);
    158147    owner = NULL;
    159148  }
     
    241230}
    242231
    243 void GLMoleculeObject_atom::resetSelectionStatus()
    244 {
    245   setSelected(AtomSelectionStatus.get());
    246 }
     232void GLMoleculeObject_atom::Selected()
     233{
     234  ASSERT( !m_selected,
     235      "GLMoleculeObject_atom::Selected() - 3D rep of atom is already selected.");
     236  m_selected = true;
     237
     238  emit changed();
     239}
     240
     241void GLMoleculeObject_atom::Unselected()
     242{
     243  ASSERT( m_selected,
     244      "GLMoleculeObject_atom::Unselected() - 3D rep of atom is already unselected.");
     245  m_selected = false;
     246
     247  emit changed();
     248}
     249
    247250
    248251void GLMoleculeObject_atom::draw(QGLPainter *painter, const QVector4D &cameraPlane)
     
    315318}
    316319
    317 bool GLMoleculeObject_atom::updateSelectionStatus() const
    318 {
    319   const atom * const _atom = getAtom(AtomIndex.get());
    320   if (_atom != NULL) {
    321     return const_cast<const World &>(World::getInstance()).isSelected(_atom);
    322   }
    323   return false;
    324 }
    325 
    326320void GLMoleculeObject_atom::update(Observable *publisher)
    327321{
     
    358352        break;
    359353    }
    360   } else if (publisher == static_cast<World *>(World::getPointer())) {
    361     switch (notification->getChannelNo()) {
    362       case World::SelectionChanged:
    363         emit selectionstatusChanged();
    364         break;
    365       default:
    366         ASSERT(0, "GLMoleculeObject_atom::recieveNotification() - we are not signed on to channel "
    367             +toString(notification->getChannelNo())+" of the World.");
    368         break;
    369     }
    370   }
    371 }
     354  } else
     355    ASSERT(0, "GLMoleculeObject_atom::recieveNotification() - received notification from unexpected source.");
     356}
Note: See TracChangeset for help on using the changeset viewer.