Changeset 4f7473 for src/UIElements/Views/Qt4
- Timestamp:
- Jul 17, 2012, 12:17:27 PM (13 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:
- 4a2f3e
- Parents:
- 7b6bcfe
- git-author:
- Michael Ankele <ankele@…> (06/18/12 15:01:14)
- git-committer:
- Michael Ankele <ankele@…> (07/17/12 12:17:27)
- Location:
- src/UIElements/Views/Qt4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Views/Qt4/QtMoleculeView.cpp
r7b6bcfe r4f7473 21 21 22 22 #include <iostream> 23 #include <QAbstractItemView> 23 24 24 25 #include "CodePatterns/MemDebug.hpp" 25 26 26 27 #include "molecule.hpp" 28 #include "Element/element.hpp" 27 29 28 30 using namespace std; … … 90 92 // Show new tabs. 91 93 if (_atom){ 92 page_atom = new QTAtomPage(_atom, "test"); 93 addTab(page_atom, "atom..."); 94 page_atom = new QTAtomPage(_atom); 95 addTab(page_atom, "Atom"); 96 97 page_mol = new QTMoleculePage(_atom->getMolecule()); 98 addTab(page_mol, "Molecule"); 94 99 } 95 100 } … … 97 102 /************************ Tab for single Atoms ********************/ 98 103 99 QTAtomPage::QTAtomPage(const atom *_atom,std::string _name) : 104 static void addInfo(QTreeWidget *info, const QString &key, const QString &value) 105 { 106 QTreeWidgetItem *treeItem = new QTreeWidgetItem(info); 107 treeItem->setText(0, key); 108 treeItem->setText(1, value); 109 } 110 111 QTAtomPage::QTAtomPage(const atom *_atom) : 100 112 Observer("QTAtomPage"), 101 atomRef(_atom) , name(_name)113 atomRef(_atom) 102 114 { 103 115 atomRef->signOn(this); 116 117 info = new QTreeWidget(this); 118 info->setColumnCount(2); 119 QStringList header; 120 header << "data"; 121 header << "value"; 122 info->setHeaderLabels(header); 123 124 addInfo(info, "Element", QString(atomRef->getElement().getName().c_str())); 125 addInfo(info, "Mass", QString("%1").arg(atomRef->getMass())); 126 addInfo(info, "Charge", QString("%1").arg(atomRef->getCharge())); 127 addInfo(info, "Position", QString(toString(atomRef->getPosition()).c_str())); 128 addInfo(info, "Bonds", QString("%1").arg(atomRef->getListOfBonds().size())); 104 129 } 105 130 … … 120 145 /************************ Tab for single Molecules *****************/ 121 146 122 QTMoleculePage::QTMoleculePage(const molecule *_mol , std::string _name) :147 QTMoleculePage::QTMoleculePage(const molecule *_mol) : 123 148 Observer("QTMoleculePage"), 124 mol(_mol) , name(_name)149 mol(_mol) 125 150 { 126 151 mol->signOn(this); 152 153 info = new QTreeWidget(this); 154 info->setColumnCount(2); 155 QStringList header; 156 header << "data"; 157 header << "value"; 158 info->setHeaderLabels(header); 159 160 addInfo(info, "Name", QString(mol->getName().c_str())); 161 addInfo(info, "Formula", QString(mol->getFormula().toString().c_str())); 162 addInfo(info, "Atoms", QString("%1").arg(mol->getAtomCount())); 163 addInfo(info, "Bonds", QString("%1").arg(mol->getBondCount())); 127 164 } 128 165 … … 132 169 133 170 void QTMoleculePage::update(Observable *subject){ 134 if(name != mol->name){135 name = mol->name;136 emit nameChanged(this,name);137 }138 171 } 139 172 -
src/UIElements/Views/Qt4/QtMoleculeView.hpp
r7b6bcfe r4f7473 17 17 #include <string> 18 18 #include <QtGui/QTabWidget> 19 #include <QtGui/QTreeWidget> 19 20 #include "CodePatterns/Observer/Observer.hpp" 20 21 … … 49 50 Q_OBJECT 50 51 public: 51 QTAtomPage(const atom *_atom ,std::string _name);52 QTAtomPage(const atom *_atom); 52 53 virtual ~QTAtomPage(); 53 54 void update(Observable *subject); 54 55 void subjectKilled(Observable *subject); 55 56 56 //public slots:57 // void nameChanged(QTAtomPage*,std::string);58 59 57 private: 60 58 const atom *atomRef; 61 std::string name;59 QTreeWidget *info; 62 60 }; 63 61 … … 68 66 Q_OBJECT 69 67 public: 70 QTMoleculePage(const molecule *_mol ,std::string _name);68 QTMoleculePage(const molecule *_mol); 71 69 virtual ~QTMoleculePage(); 72 70 … … 74 72 void subjectKilled(Observable *subject); 75 73 76 signals:77 void nameChanged(QTMoleculePage*,std::string);78 79 74 private: 80 75 const molecule *mol; 81 std::string name;76 QTreeWidget *info; 82 77 }; 83 78 #endif /* MOLECULEVIEW_HPP_ */
Note:
See TracChangeset
for help on using the changeset viewer.