Ignore:
Timestamp:
Jan 11, 2015, 4:42:43 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:
596cfa
Parents:
b6d92e
git-author:
Frederik Heber <heber@…> (12/12/14 08:28:30)
git-committer:
Frederik Heber <heber@…> (01/11/15 16:42:43)
Message:

Extended selection action for Molecule ids to multiple ids.

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

Legend:

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

    rb6d92e rd7cad1  
    150150     const molecule *mol = Walker->getMolecule();
    151151     ASSERT(mol, "Atom without molecule has been clicked.");
     152     molids_t ids(1, mol->getId());
    152153     if (!World::getInstance().isSelected(mol))
    153        SelectionMoleculeById(mol->getId());
     154       SelectionMoleculeById(ids);
    154155     else
    155        SelectionNotMoleculeById(mol->getId());
     156       SelectionNotMoleculeById(ids);
    156157   }
    157158   emit clicked(no);
     
    163164   const molecule *mol= World::getInstance().getMolecule(MoleculeById(no));
    164165   ASSERT(mol, "Atom without molecule has been clicked.");
     166   molids_t ids(1, mol->getId());
    165167   if (!World::getInstance().isSelected(mol))
    166      SelectionMoleculeById(mol->getId());
     168     SelectionMoleculeById(ids);
    167169   else
    168      SelectionNotMoleculeById(mol->getId());
     170     SelectionNotMoleculeById(ids);
    169171   emit clicked(no);
    170172}
  • src/UIElements/Views/Qt4/QtMoleculeList.cpp

    rb6d92e rd7cad1  
    268268  // Select all molecules which belong to newly selected rows.
    269269  QModelIndex index;
    270   QModelIndexList items = selected.indexes();
    271   foreach (index, items)
    272     if (index.column() == 0){
    273       int mol_id = model()->data(index, Qt::UserRole).toInt();
    274       if (mol_id < 0)
    275         continue;
    276       //std::cout << "select molecule" << std::endl;
    277       MoleCuilder::SelectionMoleculeById(mol_id);
    278     }
     270  {
     271    QModelIndexList items = selected.indexes();
     272    molids_t ids;
     273    ids.reserve(items.size());
     274    foreach (index, items)
     275      if (index.column() == 0){
     276        int mol_id = model()->data(index, Qt::UserRole).toInt();
     277        if (mol_id < 0)
     278          continue;
     279        ids.push_back(mol_id);
     280        //std::cout << "select molecule" << std::endl;
     281      }
     282    MoleCuilder::SelectionMoleculeById(ids);
     283  }
    279284
    280285  // Unselect all molecules which belong to newly unselected rows.
    281   items = deselected.indexes();
    282   foreach (index, items)
    283     if (index.column() == 0){
    284       int mol_id = model()->data(index, Qt::UserRole).toInt();
    285       if (mol_id < 0)
    286         continue;
    287       //std::cout << "unselect molecule" << std::endl;
    288       MoleCuilder::SelectionNotMoleculeById(mol_id);
    289     }
     286  {
     287    QModelIndexList items = deselected.indexes();
     288    molids_t ids;
     289    ids.reserve(items.size());
     290    foreach (index, items)
     291      if (index.column() == 0){
     292        int mol_id = model()->data(index, Qt::UserRole).toInt();
     293        if (mol_id < 0)
     294          continue;
     295        //std::cout << "unselect molecule" << std::endl;
     296        ids.push_back(mol_id);
     297      }
     298    MoleCuilder::SelectionNotMoleculeById(ids);
     299  }
    290300
    291301  selecting = false;
Note: See TracChangeset for help on using the changeset viewer.