Changeset 0f368b 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:
b43585
Parents:
5cd3a33
git-author:
Frederik Heber <heber@…> (12/28/15 19:14:32)
git-committer:
Frederik Heber <heber@…> (02/14/16 12:33:43)
Message:

Removed QtSelectionAgent usage in QtMoleculeListView.

Location:
src/UIElements
Files:
3 edited

Legend:

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

    r5cd3a33 r0f368b  
    110110  moleculeList = new QtMoleculeList(InstanceBoard, moleculeListView);
    111111  moleculeListView->setModel(moleculeList);
    112   moleculeListView->setSelectionChangedAgent(selectionagent);
    113112
    114113  elementList = new QtElementList(worldTab);
  • src/UIElements/Views/Qt4/MoleculeList/QtMoleculeListView.cpp

    r5cd3a33 r0f368b  
    3535#include "QtMoleculeListView.hpp"
    3636
     37#include <QtCore/QMetaType>
     38
    3739#include "UIElements/Views/Qt4/MoleculeList/QtMoleculeList.hpp"
    3840#include "UIElements/Views/Qt4/MoleculeList/QtMoleculeItem.hpp"
    39 #include "UIElements/Views/Qt4/QtSelectionChangedAgent.hpp"
    4041
    4142#include "CodePatterns/MemDebug.hpp"
     
    4546#include "Actions/SelectionAction/Molecules/MoleculeByIdAction.hpp"
    4647#include "Actions/SelectionAction/Molecules/NotMoleculeByIdAction.hpp"
    47 
     48#include "MoleculeObserver.hpp"
     49#include "molecule.hpp"
    4850#include "World.hpp"
    4951
     
    5456{
    5557  setSelectionMode(QAbstractItemView::MultiSelection);
     58
     59  qRegisterMetaType<QItemSelection>("QItemSelection");
     60
     61  MoleculeObserver::getInstance().signOn(this, molecule::SelectionChanged);
    5662}
    5763
    5864QtMoleculeListView::~QtMoleculeListView()
    59 {}
     65{
     66  MoleculeObserver::getInstance().signOff(this, molecule::SelectionChanged);
     67}
    6068
    6169void QtMoleculeListView::setModel(QtMoleculeList *_moleculelist)
     
    6674      selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
    6775      this, SLOT(rowsSelected(const QItemSelection &, const QItemSelection &)), Qt::DirectConnection);
    68 }
    69 
    70 
    71 void QtMoleculeListView::setSelectionChangedAgent(QtSelectionChangedAgent *agent)
    72 {
    73   connect(agent, SIGNAL(moleculeSelected(const moleculeId_t)),
    74       this, SLOT(MoleculeSelected(const moleculeId_t)));
    75   connect(agent, SIGNAL(moleculeUnselected(const moleculeId_t)),
    76       this, SLOT(MoleculeUnselected(const moleculeId_t)));
    7776}
    7877
     
    243242      }
    244243      default:
    245         ASSERT(0, "QtMoleculeListView::recieveNotification() - cannot get here, not subscribed to channel "
     244        ASSERT(0, "QtMoleculeListView::recieveNotification() - cannot get here, not subscribed to World's channel "
    246245            +toString(notification->getChannelNo()));
    247246        break;
    248247    }
     248  } else if (dynamic_cast<molecule*>(publisher) != NULL) {
     249    const molecule * const mol = dynamic_cast<molecule *>(publisher);
     250    switch (notification->getChannelNo()) {
     251      case molecule::SelectionChanged:
     252      {
     253        if (mol->getSelected())
     254          MoleculeSelected(mol->getId());
     255        else
     256          MoleculeUnselected(mol->getId());
     257        break;
     258      }
     259      default:
     260        ASSERT(0, "QtMoleculeListView::recieveNotification() - cannot get here, not subscribed to mol's channel "
     261            +toString(notification->getChannelNo()));
     262        break;
     263    }
     264  } else {
     265    ASSERT(0,
     266        "QtMoleculeListView::recieveNotification() - cannot get here, unknown publisher "+toString(publisher));
    249267  }
    250268}
  • src/UIElements/Views/Qt4/MoleculeList/QtMoleculeListView.hpp

    r5cd3a33 r0f368b  
    2222
    2323class QtMoleculeList;
    24 class QtSelectionChangedAgent;
    2524
    2625class QtMoleculeListView : public QTreeView, public Observer
     
    3433  void setModel(QtMoleculeList *_moleculelist);
    3534
    36   void setSelectionChangedAgent(QtSelectionChangedAgent *agent);
    37 
    3835public slots:
    3936  void rowsSelected(const QItemSelection&, const QItemSelection&);
    40 
    41   void MoleculeSelected(const moleculeId_t _id);
    42   void MoleculeUnselected(const moleculeId_t _id);
    4337
    4438protected:
     
    4842
    4943private:
     44  void MoleculeSelected(const moleculeId_t _id);
     45  void MoleculeUnselected(const moleculeId_t _id);
     46
    5047  QModelIndex setIndexToLastColumn(const QModelIndex &_index) const;
    5148
Note: See TracChangeset for help on using the changeset viewer.