Ignore:
Timestamp:
Apr 6, 2012, 11:57:20 AM (13 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:
a14fe3
Parents:
b14efe
git-author:
Michael Ankele <ankele@…> (03/13/12 13:24:27)
git-committer:
Frederik Heber <heber@…> (04/06/12 11:57:20)
Message:

QtElementList: selection calls actions

Location:
src/UIElements/Views/Qt4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/Views/Qt4/QtElementList.cpp

    rb14efe r1de61e  
    3333#include "Descriptors/AtomTypeDescriptor.hpp"
    3434#include <QAbstractItemView>
     35#include "Actions/SelectionAction/Atoms/AtomByElementAction.hpp"
     36#include "Actions/SelectionAction/Atoms/NotAtomByElementAction.hpp"
    3537
    3638using namespace std;
     
    5759        update(molecules);
    5860
    59         connect(this,SIGNAL(cellClicked(int,int)),this,SLOT(cellSelected(int,int)));
     61        connect(this,SIGNAL(itemSelectionChanged()),this,SLOT(rowSelected()));
    6062}
    6163
     
    6870
    6971  periodentafel *&periode = World::getInstance().getPeriode();
     72
     73  elementSelection.clear();
    7074
    7175  int i;
     
    8185
    8286    QTreeWidgetItem *treeItem = new QTreeWidgetItem(this);
    83     treeItem->setText(0, QString::number(e->getAtomicNumber()));
    84     treeItem->setText(1, QString(e->getName().c_str()));
    85     treeItem->setText(2, QString(e->getSymbol().c_str()));
    86     treeItem->setText(3, QString::number(e->getMass()));
     87    treeItem->setText(NUMBER, QString::number(e->getAtomicNumber()));
     88    treeItem->setText(NAME, QString(e->getName().c_str()));
     89    treeItem->setText(SYMBOL, QString(e->getSymbol().c_str()));
     90    treeItem->setText(MASS, QString::number(e->getMass()));
    8791    if (count > 0){
    88       treeItem->setText(4, QString::number(count));
     92      treeItem->setText(OCCURRENCE, QString::number(count));
    8993    }else{
    90       treeItem->setText(4, "none");
     94      treeItem->setText(OCCURRENCE, "none");
    9195      treeItem->setDisabled(true);
    9296    }
     97    elementSelection.push_back(treeItem->isSelected());
    9398  }
    9499}
     
    98103
    99104
    100 void QtElementList::cellSelected(int row, int column)
     105void QtElementList::rowSelected()
    101106{
     107  //std::cout << "rowSelected\n";
     108  periodentafel *&periode = World::getInstance().getPeriode();
     109
     110  for (int i=0;i<topLevelItemCount();i++){
     111    QTreeWidgetItem *item = topLevelItem(i);
     112    bool newSelection = item->isSelected();
     113    if (newSelection != elementSelection[i]){
     114      elementSelection[i] = newSelection;
     115
     116      int atomicNumber = item->text(NUMBER).toInt();
     117      const element *e = periode->FindElement(atomicNumber);
     118      if (newSelection)
     119        MoleCuilder::SelectionAtomByElement(e);
     120      else
     121        MoleCuilder::SelectionNotAtomByElement(e);
     122    }
     123  }
    102124}
    103125
  • src/UIElements/Views/Qt4/QtElementList.hpp

    rb14efe r1de61e  
    3838
    3939private slots:
    40   void cellSelected(int row, int column); // itemSelectionChanged()
     40  void rowSelected();
    4141
    4242signals:
     
    4545
    4646private:
    47   std::vector<bool> molSelection; //!< needed to determine when a selection changes
     47  std::vector<bool> elementSelection; //!< needed to determine when a selection changes
    4848  MoleculeListClass *molecules;
    4949  bool dirty;
Note: See TracChangeset for help on using the changeset viewer.