Ignore:
Timestamp:
Apr 6, 2012, 11:57:19 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:
575343
Parents:
f20fa5
git-author:
Michael Ankele <ankele@…> (03/08/12 12:41:08)
git-committer:
Frederik Heber <heber@…> (04/06/12 11:57:19)
Message:

QtElementList improved

  • occurrence added
  • connected to molecule observer
Location:
src/UIElements/Views/Qt4
Files:
2 edited

Legend:

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

    rf20fa5 r59a28e  
    3131#include "Element/element.hpp"
    3232#include "Element/periodentafel.hpp"
     33#include "Descriptors/AtomTypeDescriptor.hpp"
     34#include <QAbstractItemView>
    3335
    3436using namespace std;
    3537
    3638const int QtElementList::COLUMNCOUNT = COLUMNTYPES_MAX;
    37 const char *QtElementList::COLUMNNAMES[QtElementList::COLUMNCOUNT]={"Number","Name","Symbol","Mass"};
     39const char *QtElementList::COLUMNNAMES[QtElementList::COLUMNCOUNT]={"Number","Name","Symbol","Mass","Occurrence"};
    3840
    3941QtElementList::QtElementList(QWidget * _parent) :
     
    4244{
    4345  setColumnCount(COLUMNCOUNT);
     46  setSelectionMode(QAbstractItemView::MultiSelection);
    4447
    4548  QStringList header;
     
    4750          header << COLUMNNAMES[i];
    4851        setHeaderLabels(header);
    49         //setAllColumnsShowFocus( true );
    5052
    5153        molecules = World::getInstance().getMolecules();
     
    5355        update(molecules);
    5456
    55   periodentafel *&periode = World::getInstance().getPeriode();
    56 
    57 
    58   int i;
    59   periodentafel::const_iterator iter;
    60   for(iter = periode->begin(),i=0;
    61       iter != periode->end();
    62       ++i,++iter) {
    63     const element *e = iter->second;
    64 
    65     QTreeWidgetItem *treeItem = new QTreeWidgetItem(this);
    66     treeItem->setText(0, QString::number(e->getAtomicNumber()));
    67     treeItem->setText(1, QString(e->getName().c_str()));
    68     treeItem->setText(2, QString(e->getSymbol().c_str()));
    69     treeItem->setText(3, QString::number(e->getMass()));
    70 
    71     /*QTableWidgetItem *indexWidget = new QTableWidgetItem();
    72     //std::cout << "Creating index item " << indexWidget << "." << std::endl;
    73     indexWidget->setText(QString::number(e->getAtomicNumber()));
    74     indexWidget->setData(Qt::UserRole,QVariant(e->getAtomicNumber()));
    75     setItem(i,NUMBER,indexWidget);
    76 
    77     const string name = e->getName();
    78     QTableWidgetItem *nameWidget = new QTableWidgetItem();
    79     //std::cout << "Creating name item " << nameWidget << " at " << i << "," << NAME << "." << std::endl;
    80     nameWidget->setText(QString(name.c_str()));
    81     setItem(i,NAME,nameWidget);
    82 
    83     const string symbol = e->getSymbol();
    84     QTableWidgetItem *symWidget = new QTableWidgetItem();
    85     //std::cout << "Creating symbol item " << symWidget << " at " << i << "," << NAME << "." << std::endl;
    86     symWidget->setText(QString(symbol.c_str()));
    87     setItem(i,SYMBOL,symWidget);
    88 
    89     const double mass = e->getMass();
    90     QTableWidgetItem *massWidget= new QTableWidgetItem();
    91     //std::cout << "Creating mass item " << massWidget << " at " << i << "," << ATOMCOUNT << "." << std::endl;
    92     massWidget->setText(QString::number(mass));
    93     massWidget->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
    94     setItem(i,MASS,massWidget);*/
    95   }
    96 
    97         connect(this,SIGNAL(cellChanged(int,int)),this,SLOT(moleculeChanged(int,int)));
    9857        connect(this,SIGNAL(cellClicked(int,int)),this,SLOT(cellSelected(int,int)));
    9958}
     
    10564
    10665void QtElementList::update(Observable *publisher) {
     66
     67  periodentafel *&periode = World::getInstance().getPeriode();
     68
     69
     70  int i;
     71
     72  clear();
     73  periodentafel::const_iterator iter;
     74  for(iter = periode->begin(),i=0;
     75      iter != periode->end();
     76      ++i,++iter) {
     77    const element *e = iter->second;
     78    int count = 0;
     79    count = World::getInstance().getAllAtoms(AtomByType(e)).size();
     80
     81    QTreeWidgetItem *treeItem = new QTreeWidgetItem(this);
     82    treeItem->setText(0, QString::number(e->getAtomicNumber()));
     83    treeItem->setText(1, QString(e->getName().c_str()));
     84    treeItem->setText(2, QString(e->getSymbol().c_str()));
     85    treeItem->setText(3, QString::number(e->getMass()));
     86    if (count > 0){
     87      treeItem->setText(4, QString::number(count));
     88    }else{
     89      treeItem->setText(4, "none");
     90      treeItem->setDisabled(true);
     91    }
     92  }
    10793}
    10894
    10995void QtElementList::subjectKilled(Observable *publisher) {
    110 }
    111 
    112 void QtElementList::moleculeChanged(int row, int column) {
    11396}
    11497
  • src/UIElements/Views/Qt4/QtElementList.hpp

    rf20fa5 r59a28e  
    3434
    3535  static const int COLUMNCOUNT;
    36   enum {NUMBER,NAME,SYMBOL,MASS,COLUMNTYPES_MAX} COLUMNTYPES;
     36  enum {NUMBER,NAME,SYMBOL,MASS,OCCURRENCE,COLUMNTYPES_MAX} COLUMNTYPES;
    3737  static const char *COLUMNNAMES[];
    3838
    3939private slots:
    40   void moleculeChanged(int row, int column);
    41 
    42   void cellSelected(int row, int column);
     40  void cellSelected(int row, int column); // itemSelectionChanged()
    4341
    4442signals:
Note: See TracChangeset for help on using the changeset viewer.