Changeset cbf01e for src/UIElements/QT4
- Timestamp:
- Feb 25, 2010, 2:23:33 PM (15 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:
- 2561df
- Parents:
- 326a43b (diff), 5a7243 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- src/UIElements/QT4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/QT4/QTDialog.cpp
r326a43b rcbf01e 21 21 #include <Qt/qcombobox.h> 22 22 23 #include "World.hpp" 24 #include "periodentafel.hpp" 23 25 #include "atom.hpp" 26 #include "element.hpp" 24 27 #include "molecule.hpp" 25 28 … … 95 98 } 96 99 100 void QTDialog::queryElement(const char* title, element **target){ 101 registerQuery(new ElementQTQuery(title,target,inputLayout,this)); 102 } 103 97 104 /************************** Query Objects *******************************/ 98 105 … … 192 199 for(iter = molecules->ListOfMolecules.begin(); 193 200 iter != molecules->ListOfMolecules.end(); 194 iter++) {201 ++iter) { 195 202 stringstream sstr; 196 203 sstr << (*iter)->IndexNr << "\t" << (*iter)->getName(); … … 255 262 256 263 264 QTDialog::ElementQTQuery::ElementQTQuery(std::string _title, element **_target, QBoxLayout *_parent, QTDialog *_dialog) : 265 Dialog::ElementQuery(_title,_target), 266 parent(_parent) 267 { 268 periodentafel *periode = World::get()->getPeriode(); 269 thisLayout = new QHBoxLayout(); 270 titleLabel = new QLabel(QString(getTitle().c_str())); 271 inputBox = new QComboBox(); 272 element* Elemental = 0; 273 for(Elemental = periode->start->next; 274 Elemental!=periode->end; 275 Elemental = Elemental->next) 276 { 277 stringstream sstr; 278 sstr << Elemental->Z << "\t" << Elemental->name; 279 inputBox->addItem(QString(sstr.str().c_str()),QVariant(Elemental->Z)); 280 } 281 parent->addLayout(thisLayout); 282 thisLayout->addWidget(titleLabel); 283 thisLayout->addWidget(inputBox); 284 285 pipe = new ElementQTQueryPipe(&tmp,_dialog,inputBox); 286 pipe->update(inputBox->currentIndex()); 287 connect(inputBox,SIGNAL(currentIndexChanged(int)),pipe,SLOT(update(int))); 288 } 289 290 QTDialog::ElementQTQuery::~ElementQTQuery() 291 { 292 delete pipe; 293 } 294 295 bool QTDialog::ElementQTQuery::handle(){ 296 return true; 297 } 298 257 299 /*************************** Plumbing *******************************/ 258 300 … … 313 355 } 314 356 357 ElementQTQueryPipe::ElementQTQueryPipe(element **_content, QTDialog *_dialog, QComboBox *_theBox) : 358 content(_content), 359 dialog(_dialog), 360 theBox(_theBox) 361 {} 362 363 ElementQTQueryPipe::~ElementQTQueryPipe() 364 {} 365 366 void ElementQTQueryPipe::update(int newIndex) { 367 QVariant data = theBox->itemData(newIndex); 368 int idx = data.toInt(); 369 (*content) = World::get()->getPeriode()->FindElement(idx); 370 dialog->update(); 371 } 372 -
src/UIElements/QT4/QTDialog.hpp
r326a43b rcbf01e 26 26 class DoubleQTQueryPipe; 27 27 class MoleculeQTQueryPipe; 28 class ElementQTQueryPipe; 28 29 29 30 class QTDialog : public QDialog, public Dialog … … 39 40 virtual void queryMolecule(const char*,molecule**,MoleculeListClass*); 40 41 virtual void queryVector(const char*,Vector *,const double *const,bool); 42 virtual void queryElement(const char*,element **); 41 43 42 44 virtual bool display(); … … 48 50 public: 49 51 IntQTQuery(std::string _title, int *_target,QBoxLayout *_parent,QTDialog *_dialog); 50 ~IntQTQuery();52 virtual ~IntQTQuery(); 51 53 virtual bool handle(); 52 54 private: … … 62 64 public: 63 65 DoubleQTQuery(std::string title, double *_target,QBoxLayout *_parent,QTDialog *_dialog); 64 ~DoubleQTQuery();66 virtual ~DoubleQTQuery(); 65 67 virtual bool handle(); 66 68 private: … … 76 78 public: 77 79 StringQTQuery(std::string _title, std::string *_target, QBoxLayout *_parent,QTDialog *_dialog); 78 ~StringQTQuery();80 virtual ~StringQTQuery(); 79 81 virtual bool handle(); 80 82 private: … … 90 92 public: 91 93 MoleculeQTQuery(std::string _title, molecule **_target, MoleculeListClass *_molecules, QBoxLayout *_parent,QTDialog *_dialog); 92 ~MoleculeQTQuery();94 virtual ~MoleculeQTQuery(); 93 95 virtual bool handle(); 94 96 private: … … 104 106 public: 105 107 VectorQTQuery(std::string title,Vector *_target,const double *const _cellSize,bool _check,QBoxLayout *,QTDialog *); 106 ~VectorQTQuery();108 virtual ~VectorQTQuery(); 107 109 virtual bool handle(); 108 110 private: … … 118 120 }; 119 121 122 class ElementQTQuery : public Dialog::ElementQuery { 123 public: 124 ElementQTQuery(std::string _title, element **_target, QBoxLayout *_parent, QTDialog *_dialog); 125 virtual ~ElementQTQuery(); 126 virtual bool handle(); 127 private: 128 QBoxLayout *parent; 129 QBoxLayout *thisLayout; 130 QLabel *titleLabel; 131 QComboBox *inputBox; 132 133 ElementQTQueryPipe *pipe; 134 }; 135 120 136 private: 121 137 QBoxLayout *mainLayout; … … 133 149 public: 134 150 StringQTQueryPipe(std::string *_content, QTDialog *_dialog); 135 ~StringQTQueryPipe();151 virtual ~StringQTQueryPipe(); 136 152 137 153 public slots: … … 148 164 public: 149 165 IntQTQueryPipe(int *_content, QTDialog *_dialog); 150 ~IntQTQueryPipe();166 virtual ~IntQTQueryPipe(); 151 167 152 168 public slots: … … 163 179 public: 164 180 DoubleQTQueryPipe(double *_content, QTDialog *_dialog); 165 ~DoubleQTQueryPipe();181 virtual ~DoubleQTQueryPipe(); 166 182 167 183 public slots: … … 178 194 public: 179 195 MoleculeQTQueryPipe(molecule **_content, QTDialog *_dialog, QComboBox *_theBox, MoleculeListClass *_molecules); 180 ~MoleculeQTQueryPipe();196 virtual ~MoleculeQTQueryPipe(); 181 197 182 198 public slots: … … 190 206 191 207 }; 208 209 class ElementQTQueryPipe : public QWidget { 210 Q_OBJECT 211 public: 212 ElementQTQueryPipe(element **_content, QTDialog *_dialog, QComboBox *_theBox); 213 virtual ~ElementQTQueryPipe(); 214 215 public slots: 216 void update(int); 217 218 private: 219 element **content; 220 QTDialog *dialog; 221 QComboBox *theBox; 222 }; 192 223 #endif /* QTDIALOG_HPP_ */
Note:
See TracChangeset
for help on using the changeset viewer.