Changeset 2f4e81 for src/UIElements/Qt4
- Timestamp:
- Jul 24, 2012, 3:21:01 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:
- 1ae820
- Parents:
- 7e8e79
- git-author:
- Michael Ankele <ankele@…> (07/24/12 14:46:07)
- git-committer:
- Michael Ankele <ankele@…> (07/24/12 15:21:01)
- Location:
- src/UIElements/Qt4/Query
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Qt4/Query/AtomsQtQuery.cpp
r7e8e79 r2f4e81 18 18 #endif 19 19 20 #include <Qt/qpushbutton.h> 20 21 #include <Qt/qboxlayout.h> 21 #include <Qt/qlabel.h>22 #include <Qt/qlineedit.h>23 22 #include <Qt/qlistwidget.h> 24 #include <Qt/qpushbutton.h>25 23 26 24 #include "CodePatterns/MemDebug.hpp" 27 25 28 26 #include "UIElements/Qt4/Query/QtQuery.hpp" 29 #include "UIElements/Qt4/Pipe/AtomsQtQueryPipe.hpp" 30 31 #include "Atom/atom.hpp" 32 #include "World.hpp" 27 #include "UIElements/Qt4/Query/QtQueryList.hpp" 28 #include "UIElements/Qt4/Pipe/QtQueryListPipe.hpp" 33 29 34 30 35 31 QtDialog::AtomsQtQuery::AtomsQtQuery(Parameter<std::vector<const atom *> > &_param, std::string _title,QBoxLayout *_parent,Dialog *_dialog) : 36 32 Dialog::AtomsQuery(_param, _title), 37 parent(_parent), 38 dialog(_dialog) 33 QtQueryList<const atom *>(_parent, _dialog, temp) 39 34 { 40 QHBoxLayout * thisHLayout = new QHBoxLayout();41 QVBoxLayout * thisV1Layout = new QVBoxLayout();42 QVBoxLayout * thisV2Layout = new QVBoxLayout();35 ListQuerySubDialog *subDialog = new ListQuerySubDialog(this); 36 subQuery = new AtomQtQuery(*subParam, _title, thisVLayout, subDialog); 37 subDialog->setSubQuery(subQuery); 43 38 44 titleLabel = new QLabel(QString(getTitle().c_str())); 45 inputLabel = new QLabel("Enter to add"); 46 inputList = new QListWidget(); 47 inputList->setSelectionMode(QAbstractItemView::ExtendedSelection); 48 std::vector<atom *> atoms = World::getInstance().getAllAtoms(); 49 for (std::vector<atom *>::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter) 50 inputList->insertItem((*iter)->getNr(),QString((*iter)->getNr())); 51 52 QLineEdit* inputBox = new QLineEdit(); 53 inputLabel->setBuddy(inputBox); 54 titleLabel->setBuddy(inputList); 55 QPushButton* AddButton = new QPushButton("Add"); 56 AddButton->setEnabled(false); 57 QPushButton* RemoveButton = new QPushButton("Remove"); 58 RemoveButton->setEnabled(false); 59 60 thisV1Layout->addWidget(titleLabel); 61 thisV1Layout->addWidget(inputList); 62 thisV2Layout->addWidget(inputLabel); 63 thisV2Layout->addWidget(inputBox); 64 thisV2Layout->addWidget(AddButton); 65 thisV2Layout->addWidget(RemoveButton); 66 parent->addLayout(thisHLayout); 67 thisHLayout->addLayout(thisV1Layout); 68 thisHLayout->addLayout(thisV2Layout); 69 70 /*connect(inputList,SIGNAL(itemSelectionChanged()),pipe,SLOT(IntegerSelected())); 71 connect(AddButton,SIGNAL(Clicked()),pipe,SLOT(add())); 72 connect(RemoveButton,SIGNAL(Clicked()),pipe,SLOT(remove()));*/ 39 connect(inputList,SIGNAL(itemSelectionChanged()),this,SLOT(onElementSelected())); 40 connect(addButton,SIGNAL(clicked()),this,SLOT(onAddElement())); 41 connect(removeButton,SIGNAL(clicked()),this,SLOT(onRemoveElement())); 73 42 } 74 43 75 44 QtDialog::AtomsQtQuery::~AtomsQtQuery() 76 45 { 46 delete(subQuery); 77 47 } 78 48 79 void QtDialog::AtomsQtQuery::onUpdate() { 80 dialog->update(); 49 void QtDialog::AtomsQtQuery::onSubUpdate() 50 { 51 addButton->setEnabled(subParam->isSet()); 81 52 } 82 53 83 bool QtDialog::AtomsQtQuery::handle() { 54 void QtDialog::AtomsQtQuery::onElementSelected() { 55 elementSelected(); 56 } 57 58 void QtDialog::AtomsQtQuery::onAddElement() { 59 addElement(); 60 } 61 62 void QtDialog::AtomsQtQuery::onRemoveElement() { 63 removeElements(); 64 } 65 66 bool QtDialog::AtomsQtQuery::handle() 67 { 84 68 if (param.isValid(temp)){ 85 69 param.set(temp); … … 89 73 } 90 74 75 76 -
src/UIElements/Qt4/Query/QtQuery.hpp
r7e8e79 r2f4e81 53 53 }; 54 54 55 class QtDialog::AtomsQtQuery : public QWidget, public Dialog::AtomsQuery {55 class QtDialog::AtomsQtQuery : public QWidget, public Dialog::AtomsQuery, public QtQueryList<const atom *> { 56 56 Q_OBJECT 57 57 public: … … 60 60 virtual bool handle(); 61 61 62 public slots: 63 void onUpdate(); 64 65 private: 66 QBoxLayout *parent; 67 QBoxLayout *thisLayout; 68 QLabel *titleLabel; 69 QLabel *inputLabel; 70 QListWidget *inputList; 71 Dialog *dialog; 62 virtual void onSubUpdate(); 63 64 public slots: 65 void onAddElement(); 66 void onRemoveElement(); 67 void onElementSelected(); 68 69 private: 70 AtomQtQuery *subQuery; 72 71 }; 73 72
Note:
See TracChangeset
for help on using the changeset viewer.