Changeset 546f7d


Ignore:
Timestamp:
Sep 9, 2016, 10:09:47 AM (8 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_StructOpt_integration_tests, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, 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_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, GeometryObjects, Gui_displays_atomic_force_velocity, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, Ubuntu_1604_changes, stable
Children:
9bdbc7
Parents:
d88397
git-author:
Frederik Heber <heber@…> (09/04/16 15:39:00)
git-committer:
Frederik Heber <heber@…> (09/09/16 10:09:47)
Message:

FIX: Selections in QtFragmentList works even under resorting.

File:
1 edited

Legend:

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

    rd88397 r546f7d  
    3737
    3838#include <QAbstractItemView>
     39
     40#include <iterator>
     41#include <iostream>
     42
     43#include <boost/lexical_cast.hpp>
    3944
    4045#include "CodePatterns/MemDebug.hpp"
     
    209214    QTreeWidgetItem *item = topLevelItem(i);
    210215    bool newSelection = item->isSelected();
    211     if (newSelection != FragmentSelection[i]){
     216    const int itemno = boost::lexical_cast<int>(item->text(NUMBER).toStdString());
     217    if (newSelection != FragmentSelection[itemno]){
     218//      LOG(1, "INFO: selection changed for item #" << itemno);
    212219      // get the keyset and select the specific atoms
    213       if (!newSelection)
    214         for (IndexSet::const_iterator iter = indexsets[i].begin();
    215             iter != indexsets[i].end();
     220      if (!newSelection) {
     221//        LOG(2, "INFO: Seeing unselection for item #" << itemno);
     222        for (IndexSet::const_iterator iter = indexsets[itemno].begin();
     223            iter != indexsets[itemno].end();
    216224            ++iter)
    217225          World::getInstance().unselectAtom(*iter);
     226      }
    218227    }
    219228  }
     
    222231    QTreeWidgetItem *item = topLevelItem(i);
    223232    bool newSelection = item->isSelected();
    224     if (newSelection != FragmentSelection[i]){
    225       FragmentSelection[i] = newSelection;
     233    const int itemno = boost::lexical_cast<int>(item->text(NUMBER).toStdString());
     234    if (newSelection != FragmentSelection[itemno]){
     235      FragmentSelection[itemno] = newSelection;
    226236      // get the keyset and select the specific atoms
    227       if (newSelection)
    228         for (IndexSet::const_iterator iter = indexsets[i].begin();
    229             iter != indexsets[i].end();
     237      if (newSelection) {
     238//        LOG(2, "INFO: Seeing selection for item #" << itemno);
     239        for (IndexSet::const_iterator iter = indexsets[itemno].begin();
     240            iter != indexsets[itemno].end();
    230241            ++iter)
    231242          World::getInstance().selectAtom(*iter);
     243      }
    232244    }
    233245  }
Note: See TracChangeset for help on using the changeset viewer.