Changeset 739ee9 for src/UIElements/Views/Qt4/QtMoleculeList.cpp
- Timestamp:
- Jan 10, 2015, 5:14:32 PM (10 years ago)
- 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:
- 34e7fdb
- Parents:
- 8c001a
- git-author:
- Frederik Heber <heber@…> (11/05/14 22:00:40)
- git-committer:
- Frederik Heber <heber@…> (01/10/15 17:14:32)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Views/Qt4/QtMoleculeList.cpp
r8c001a r739ee9 55 55 // these attributes are skipped so far 56 56 const int QtMoleculeList::COLUMNCOUNT = COLUMNTYPES_MAX; 57 const char *QtMoleculeList::COLUMNNAMES[QtMoleculeList::COLUMNCOUNT]={"Name"," Atoms","Formula","Occurrence"/*,"Size"*/};57 const char *QtMoleculeList::COLUMNNAMES[QtMoleculeList::COLUMNCOUNT]={"Name","Visibility", "Atoms","Formula","Occurrence"/*,"Size"*/}; 58 58 59 59 QtMoleculeList::QtMoleculeList(QWidget * _parent) : … … 81 81 //connect(this,SIGNAL(cellChanged(int,int)),this,SLOT(moleculeChanged(int,int))); 82 82 connect(selectionModel(),SIGNAL(selectionChanged(QItemSelection, QItemSelection)),this,SLOT(rowsSelected(QItemSelection, QItemSelection))); 83 83 connect(this, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(visibilityChanged(QTreeWidgetItem*, int))); 84 84 } 85 85 … … 128 128 formula.push_back((*iter)->getFormula()); 129 129 groupItem = new QTreeWidgetItem(this); 130 groupItem->setText(0, QString("default")); 131 groupItem->setText(1, QString::number(0)); 132 groupItem->setText(2, QString("")); 133 groupItem->setText(3, "0"); 130 groupItem->setText(NAME, QString("default")); 131 // groupItem->setFlags(groupItem->flags() | Qt::ItemIsUserCheckable); 132 // groupItem->setCheckState(VISIBILITY, Qt::Checked); 133 groupItem->setText(ATOMCOUNT, QString::number(0)); 134 groupItem->setText(FORMULA, QString("")); 135 groupItem->setText(OCCURRENCE, "0"); 134 136 groupItem->setData(0, Qt::UserRole, QVariant(-1)); 135 137 } … … 137 139 // add molecule 138 140 QTreeWidgetItem *molItem = new QTreeWidgetItem(groupItem); 139 molItem->setText(0, QString((*iter)->getName().c_str())); 140 molItem->setText(1, QString::number((*iter)->getAtomCount())); 141 molItem->setText(2, QString((*iter)->getFormula().toString().c_str())); 141 molItem->setText(NAME, QString((*iter)->getName().c_str())); 142 molItem->setFlags(groupItem->flags() | Qt::ItemIsUserCheckable); 143 molItem->setCheckState(VISIBILITY, Qt::Unchecked); 144 molItem->setText(ATOMCOUNT, QString::number((*iter)->getAtomCount())); 145 molItem->setText(FORMULA, QString((*iter)->getFormula().toString().c_str())); 142 146 const int index = (*iter)->getId(); 143 147 molItem->setData(0, Qt::UserRole, QVariant(index)); … … 146 150 147 151 // increase group occurrence 148 int count = groupItem->text( 3).toInt() + 1;149 groupItem->setText( 3, QString::number(count));152 int count = groupItem->text(4).toInt() + 1; 153 groupItem->setText(OCCURRENCE, QString::number(count)); 150 154 } 151 155 dirty = false; … … 161 165 162 166 void QtMoleculeList::subjectKilled(Observable *publisher) { 167 } 168 169 void QtMoleculeList::visibilityChanged(QTreeWidgetItem* item, int column) 170 { 171 if (column == VISIBILITY) { 172 const moleculeId_t molid = item->data(0, Qt::UserRole).toInt(); 173 const bool visible = item->checkState(VISIBILITY); 174 emit moleculesVisibilityChanged(molid, visible); 175 } 163 176 } 164 177
Note:
See TracChangeset
for help on using the changeset viewer.