Changeset 1ae820 for src/UIElements/Qt4
- Timestamp:
- Jul 24, 2012, 3:21:17 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:
- 08e137
- Parents:
- 2f4e81
- git-author:
- Michael Ankele <ankele@…> (07/24/12 14:50:05)
- git-committer:
- Michael Ankele <ankele@…> (07/24/12 15:21:17)
- Location:
- src/UIElements/Qt4/Query
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Qt4/Query/MoleculesQtQuery.cpp
r2f4e81 r1ae820 18 18 #endif 19 19 20 #include <Qt/qpushbutton.h> 20 21 #include <Qt/qboxlayout.h> 21 #include <Qt/qcombobox.h> 22 #include <Qt/qlabel.h> 22 #include <Qt/qlistwidget.h> 23 23 24 24 #include "CodePatterns/MemDebug.hpp" 25 25 26 26 #include "UIElements/Qt4/Query/QtQuery.hpp" 27 #include "UIElements/Qt4/Pipe/MoleculesQtQueryPipe.hpp" 28 29 #include "molecule.hpp" 30 #include "World.hpp" 27 #include "UIElements/Qt4/Query/QtQueryList.hpp" 28 #include "UIElements/Qt4/Pipe/QtQueryListPipe.hpp" 31 29 32 30 33 QtDialog::MoleculesQtQuery::MoleculesQtQuery(Parameter<std::vector<const molecule *> > &_param, std::string _title, 31 QtDialog::MoleculesQtQuery::MoleculesQtQuery(Parameter<std::vector<const molecule *> > &_param, std::string _title,QBoxLayout *_parent,Dialog *_dialog) : 34 32 Dialog::MoleculesQuery(_param, _title), 35 parent(_parent), 36 dialog(_dialog) 33 QtQueryList<const molecule *>(_parent, _dialog, temp) 37 34 { 38 thisLayout = new QHBoxLayout(); 39 titleLabel = new QLabel(QString(getTitle().c_str())); 40 inputBox = new QComboBox(); 41 // add all molecules to the combo box 42 vector<molecule*> molecules = World::getInstance().getAllMolecules(); 43 for(vector<molecule*>::iterator iter = molecules.begin(); 44 iter != molecules.end(); 45 ++iter) { 46 std::stringstream sstr; 47 sstr << (*iter)->IndexNr << "\t" << (*iter)->getName(); 48 inputBox->addItem(QString(sstr.str().c_str()),QVariant((*iter)->IndexNr)); 49 } 50 parent->addLayout(thisLayout); 51 thisLayout->addWidget(titleLabel); 52 thisLayout->addWidget(inputBox); 35 ListQuerySubDialog *subDialog = new ListQuerySubDialog(this); 36 subQuery = new MoleculeQtQuery(*subParam, _title, thisVLayout, subDialog); 37 subDialog->setSubQuery(subQuery); 53 38 54 /*pipe = new MoleculesQtQueryPipe(temp,_dialog,inputBox);55 pipe->update(inputBox->currentIndex());56 connect( inputBox,SIGNAL(currentIndexChanged(int)),pipe,SLOT(update(int)));*/39 connect(inputList,SIGNAL(itemSelectionChanged()),this,SLOT(onElementSelected())); 40 connect(addButton,SIGNAL(clicked()),this,SLOT(onAddElement())); 41 connect(removeButton,SIGNAL(clicked()),this,SLOT(onRemoveElement())); 57 42 } 58 43 59 44 QtDialog::MoleculesQtQuery::~MoleculesQtQuery() 60 45 { 46 delete(subQuery); 61 47 } 62 48 63 void QtDialog::MoleculesQtQuery::onUpdate() { 64 dialog->update(); 49 void QtDialog::MoleculesQtQuery::onSubUpdate() 50 { 51 addButton->setEnabled(subParam->isSet()); 65 52 } 66 53 67 // Handling is easy, since the GUI makes it impossible to select invalid values 54 void QtDialog::MoleculesQtQuery::onElementSelected() { 55 elementSelected(); 56 } 57 58 void QtDialog::MoleculesQtQuery::onAddElement() { 59 addElement(); 60 } 61 62 void QtDialog::MoleculesQtQuery::onRemoveElement() { 63 removeElements(); 64 } 65 68 66 bool QtDialog::MoleculesQtQuery::handle() 69 67 { … … 75 73 } 76 74 75 76 -
src/UIElements/Qt4/Query/QtQuery.hpp
r2f4e81 r1ae820 284 284 }; 285 285 286 class QtDialog::MoleculesQtQuery : public QWidget, public Dialog::MoleculesQuery {286 class QtDialog::MoleculesQtQuery : public QWidget, public Dialog::MoleculesQuery, public QtQueryList<const molecule *> { 287 287 Q_OBJECT 288 288 public: … … 291 291 virtual bool handle(); 292 292 293 public slots: 294 void onUpdate(); 295 296 private: 297 QBoxLayout *parent;298 QBoxLayout *thisLayout;299 QLabel *titleLabel; 300 QComboBox *inputBox; 301 Dialog *dialog;293 virtual void onSubUpdate(); 294 295 public slots: 296 void onAddElement(); 297 void onRemoveElement(); 298 void onElementSelected(); 299 300 private: 301 MoleculeQtQuery *subQuery; 302 302 }; 303 303
Note:
See TracChangeset
for help on using the changeset viewer.