Ignore:
Timestamp:
Jan 10, 2015, 5:14:32 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:
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)
Message:

GLMoleculeObject have m_visible, settable in QtMoleculeList.

  • is connected via QtMainWindow an GLWorldView, GLWorldScene.
  • i.e. molecule's atoms and bond display can now be switched on and off.
File:
1 edited

Legend:

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

    r8c001a r739ee9  
    5555// these attributes are skipped so far
    5656const int QtMoleculeList::COLUMNCOUNT = COLUMNTYPES_MAX;
    57 const char *QtMoleculeList::COLUMNNAMES[QtMoleculeList::COLUMNCOUNT]={"Name","Atoms","Formula","Occurrence"/*,"Size"*/};
     57const char *QtMoleculeList::COLUMNNAMES[QtMoleculeList::COLUMNCOUNT]={"Name","Visibility", "Atoms","Formula","Occurrence"/*,"Size"*/};
    5858
    5959QtMoleculeList::QtMoleculeList(QWidget * _parent) :
     
    8181  //connect(this,SIGNAL(cellChanged(int,int)),this,SLOT(moleculeChanged(int,int)));
    8282  connect(selectionModel(),SIGNAL(selectionChanged(QItemSelection, QItemSelection)),this,SLOT(rowsSelected(QItemSelection, QItemSelection)));
    83 
     83  connect(this, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(visibilityChanged(QTreeWidgetItem*, int)));
    8484}
    8585
     
    128128      formula.push_back((*iter)->getFormula());
    129129      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");
    134136      groupItem->setData(0, Qt::UserRole, QVariant(-1));
    135137    }
     
    137139    // add molecule
    138140    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()));
    142146    const int index = (*iter)->getId();
    143147    molItem->setData(0, Qt::UserRole, QVariant(index));
     
    146150
    147151    // 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));
    150154  }
    151155  dirty = false;
     
    161165
    162166void QtMoleculeList::subjectKilled(Observable *publisher) {
     167}
     168
     169void 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  }
    163176}
    164177
Note: See TracChangeset for help on using the changeset viewer.