Changeset 572701 for src/UIElements/Qt4
- Timestamp:
- Jul 24, 2012, 3:20:03 PM (12 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:
- 324403
- Parents:
- f84992
- git-author:
- Michael Ankele <ankele@…> (07/24/12 14:08:40)
- git-committer:
- Michael Ankele <ankele@…> (07/24/12 15:20:03)
- Location:
- src/UIElements/Qt4/Query
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Qt4/Query/ElementsQtQuery.cpp
rf84992 r572701 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 27 #include "UIElements/Qt4/Query/QtQuery.hpp" 27 #include "UIElements/Qt4/Pipe/ElementsQtQueryPipe.hpp" 28 29 #include "Element/element.hpp" 30 #include "Element/periodentafel.hpp" 31 #include "World.hpp" 28 #include "UIElements/Qt4/Query/QtQueryList.hpp" 29 #include "UIElements/Qt4/Pipe/QtQueryListPipe.hpp" 32 30 33 31 34 QtDialog::ElementsQtQuery::ElementsQtQuery(Parameter<std::vector<const element *> > &_param, std::string _title, QBoxLayout *_parent,Dialog *_dialog) :32 QtDialog::ElementsQtQuery::ElementsQtQuery(Parameter<std::vector<const element *> > &_param, std::string _title,QBoxLayout *_parent,Dialog *_dialog) : 35 33 Dialog::ElementsQuery(_param, _title), 36 parent(_parent), 37 dialog(_dialog) 34 QtQueryList<const element *>(_parent, _dialog, temp) 38 35 { 39 periodentafel *periode = World::getInstance().getPeriode(); 40 thisLayout = new QHBoxLayout(); 41 titleLabel = new QLabel(QString(getTitle().c_str())); 42 inputBox = new QComboBox(); 43 for(periodentafel::const_iterator iter = periode->begin(); 44 iter!=periode->end(); 45 ++iter) 46 { 47 std::stringstream sstr; 48 sstr << (*iter).first << "\t" << (*iter).second->getName(); 49 inputBox->addItem(QString(sstr.str().c_str()),QVariant((*iter).first)); 50 } 51 parent->addLayout(thisLayout); 52 thisLayout->addWidget(titleLabel); 53 thisLayout->addWidget(inputBox); 36 ListQuerySubDialog *subDialog = new ListQuerySubDialog(this); 37 subQuery = new ElementQtQuery(*subParam, _title, thisVLayout, subDialog); 38 subDialog->setSubQuery(subQuery); 54 39 55 /*pipe = new ElementsQtQueryPipe(temp,_dialog,inputBox);56 pipe->update(inputBox->currentIndex());57 connect( inputBox,SIGNAL(currentIndexChanged(int)),pipe,SLOT(update(int)));*/40 connect(inputList,SIGNAL(itemSelectionChanged()),this,SLOT(onElementSelected())); 41 connect(addButton,SIGNAL(clicked()),this,SLOT(onAddElement())); 42 connect(removeButton,SIGNAL(clicked()),this,SLOT(onRemoveElement())); 58 43 } 59 44 60 45 QtDialog::ElementsQtQuery::~ElementsQtQuery() 61 46 { 47 delete(subQuery); 62 48 } 63 49 64 void QtDialog::ElementsQtQuery::onUpdate() { 65 dialog->update(); 50 void QtDialog::ElementsQtQuery::onSubUpdate() 51 { 52 addButton->setEnabled(subParam->isSet()); 66 53 } 67 54 68 bool QtDialog::ElementsQtQuery::handle(){ 55 void QtDialog::ElementsQtQuery::onElementSelected() { 56 elementSelected(); 57 } 58 59 void QtDialog::ElementsQtQuery::onAddElement() { 60 addElement(); 61 } 62 63 void QtDialog::ElementsQtQuery::onRemoveElement() { 64 removeElements(); 65 } 66 67 bool QtDialog::ElementsQtQuery::handle() 68 { 69 69 if (param.isValid(temp)){ 70 70 param.set(temp); … … 74 74 } 75 75 76 -
src/UIElements/Qt4/Query/QtQuery.hpp
rf84992 r572701 162 162 }; 163 163 164 class QtDialog::ElementsQtQuery : public QWidget, public Dialog::ElementsQuery {165 Q_OBJECT 166 public: 167 ElementsQtQuery(Parameter<std::vector<const element *> > &, std::string _title, QBoxLayout *_parent, 164 class QtDialog::ElementsQtQuery : public QWidget, public Dialog::ElementsQuery, public QtQueryList<const element *> { 165 Q_OBJECT 166 public: 167 ElementsQtQuery(Parameter<std::vector<const element *> > &, std::string _title, QBoxLayout *_parent,Dialog *_dialog); 168 168 virtual ~ElementsQtQuery(); 169 169 virtual bool handle(); 170 170 171 public slots: 172 void onUpdate(); 173 174 private: 175 QBoxLayout *parent;176 QBoxLayout *thisLayout;177 QLabel *titleLabel; 178 QComboBox *inputBox; 179 Dialog *dialog;171 virtual void onSubUpdate(); 172 173 public slots: 174 void onAddElement(); 175 void onRemoveElement(); 176 void onElementSelected(); 177 178 private: 179 ElementQtQuery *subQuery; 180 180 }; 181 181
Note:
See TracChangeset
for help on using the changeset viewer.