Changeset f20fa5 for src


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:
59a28e
Parents:
0e6156
git-author:
Michael Ankele <ankele@…> (03/08/12 10:08:44)
git-committer:
Frederik Heber <heber@…> (04/06/12 11:57:19)
Message:

made QtElementList a QTreeWidget

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

Legend:

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

    r0e6156 rf20fa5  
    3838
    3939QtElementList::QtElementList(QWidget * _parent) :
    40     QTableWidget (_parent),
     40    QTreeWidget (_parent),
    4141    Observer("QtElementList")
    4242{
    43         setColumnCount(COLUMNCOUNT);
     43  setColumnCount(COLUMNCOUNT);
    4444
    45         for(int i=0; i<COLUMNCOUNT;++i) {
    46                 QTableWidgetItem *heading = new QTableWidgetItem();
    47                 std::cout << "Creating heading item " << heading << "." << std::endl;
    48                 heading->setText(QString(COLUMNNAMES[i]));
    49                 setHorizontalHeaderItem(i,heading);
    50         }
     45  QStringList header;
     46        for(int i=0; i<COLUMNCOUNT;++i)
     47          header << COLUMNNAMES[i];
     48        setHeaderLabels(header);
     49        //setAllColumnsShowFocus( true );
    5150
    5251        molecules = World::getInstance().getMolecules();
     
    5453        update(molecules);
    5554
    56   setRowCount(20);
    5755  periodentafel *&periode = World::getInstance().getPeriode();
    58   //for(periodentafel::iterator it = periode->begin(); it < periode->end(); it ++){}
    5956
    60   int i=0;
    61   for (int ni=1;ni<200;ni++){
    62     const element *e = periode->FindElement(ni);
    63     if (e){
    6457
    65       QTableWidgetItem *indexWidget = new QTableWidgetItem();
    66       //std::cout << "Creating index item " << indexWidget << "." << std::endl;
    67       indexWidget->setText(QString::number(e->getAtomicNumber()));
    68       indexWidget->setData(Qt::UserRole,QVariant(e->getAtomicNumber()));
    69       setVerticalHeaderItem(i,indexWidget);
     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;
    7064
    71       const string name = e->getName();
    72       QTableWidgetItem *nameWidget = new QTableWidgetItem();
    73       //std::cout << "Creating name item " << nameWidget << " at " << i << "," << NAME << "." << std::endl;
    74       nameWidget->setText(QString(name.c_str()));
    75       setItem(i,NAME,nameWidget);
     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()));
    7670
    77       const string symbol = e->getSymbol();
    78       QTableWidgetItem *symWidget = new QTableWidgetItem();
    79       //std::cout << "Creating name item " << nameWidget << " at " << i << "," << NAME << "." << std::endl;
    80       symWidget->setText(QString(symbol.c_str()));
    81       setItem(i,SYMBOL,symWidget);
     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);
    8276
    83       const double mass = e->getMass();
    84       QTableWidgetItem *massWidget= new QTableWidgetItem();
    85       //std::cout << "Creating count item " << countWidget << " at " << i << "," << ATOMCOUNT << "." << std::endl;
    86       massWidget->setText(QString::number(mass));
    87       massWidget->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
    88       setItem(i,MASS,massWidget);
     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);
    8982
    90       i ++;
    91     }
     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);*/
    9295  }
    9396
  • src/UIElements/Views/Qt4/QtElementList.hpp

    r0e6156 rf20fa5  
    1515
    1616
    17 #include <QtGui/QTableWidget>
     17#include <QtGui/QTreeWidget>
    1818#include "CodePatterns/Observer/Observer.hpp"
    1919
     
    2121class MoleculeListClass;
    2222
    23 class QtElementList: public QTableWidget, public Observer
     23class QtElementList: public QTreeWidget, public Observer
    2424{
    2525  Q_OBJECT
Note: See TracChangeset for help on using the changeset viewer.