Changeset 26ac2d for src/UIElements/Qt4
- Timestamp:
- Jul 24, 2012, 3:20:31 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:
- 7e8e79
- Parents:
- 324403
- git-author:
- Michael Ankele <ankele@…> (07/24/12 14:37:47)
- git-committer:
- Michael Ankele <ankele@…> (07/24/12 15:20:31)
- Location:
- src/UIElements/Qt4/Query
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Qt4/Query/IntsQtQuery.cpp
r324403 r26ac2d 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" 27 #include "UIElements/Qt4/Query/QtQueryList.hpp" 29 28 #include "UIElements/Qt4/Pipe/QtQueryListPipe.hpp" 30 29 … … 32 31 QtDialog::IntsQtQuery::IntsQtQuery(Parameter<std::vector<int> > &_param, std::string _title,QBoxLayout *_parent,Dialog *_dialog) : 33 32 Dialog::IntsQuery(_param, _title), 34 parent(_parent), 35 dialog(_dialog) 33 QtQueryList<int>(_parent, _dialog, temp) 36 34 { 37 QHBoxLayout * thisHLayout = new QHBoxLayout();38 QVBoxLayout * thisV1Layout = new QVBoxLayout();39 QVBoxLayout * thisV2Layout = new QVBoxLayout();35 ListQuerySubDialog *subDialog = new ListQuerySubDialog(this); 36 subQuery = new IntQtQuery(*subParam, _title, thisVLayout, subDialog); 37 subDialog->setSubQuery(subQuery); 40 38 41 QLabel *titleLabel = new QLabel(QString(getTitle().c_str())); 42 QLabel *inputLabel = new QLabel("Enter to add"); 43 QListWidget* inputList = new QListWidget(); 44 inputList->setSelectionMode(QAbstractItemView::ExtendedSelection); 45 QLineEdit* inputBox = new QLineEdit(); 46 inputLabel->setBuddy(inputBox); 47 titleLabel->setBuddy(inputList); 48 QPushButton* AddButton = new QPushButton("Add"); 49 AddButton->setEnabled(false); 50 QPushButton* RemoveButton = new QPushButton("Remove"); 51 RemoveButton->setEnabled(false); 52 53 thisV1Layout->addWidget(titleLabel); 54 thisV1Layout->addWidget(inputList); 55 thisV2Layout->addWidget(inputLabel); 56 thisV2Layout->addWidget(inputBox); 57 thisV2Layout->addWidget(AddButton); 58 thisV2Layout->addWidget(RemoveButton); 59 parent->addLayout(thisHLayout); 60 thisHLayout->addLayout(thisV1Layout); 61 thisHLayout->addLayout(thisV2Layout); 62 63 /*pipe = new QtQueryListPipe<int>(temp,_dialog,inputBox,inputList,AddButton,RemoveButton); 64 connect(inputBox,SIGNAL(textChanged(const QString&)),pipe,SLOT(IntegerEntered(const QString&))); 65 connect(inputList,SIGNAL(itemSelectionChanged()),pipe,SLOT(IntegerSelected())); 66 connect(AddButton,SIGNAL(Clicked()),pipe,SLOT(AddValue())); 67 connect(RemoveButton,SIGNAL(Clicked()),pipe,SLOT(RemoveRow()));*/ 39 connect(inputList,SIGNAL(itemSelectionChanged()),this,SLOT(onElementSelected())); 40 connect(addButton,SIGNAL(clicked()),this,SLOT(onAddElement())); 41 connect(removeButton,SIGNAL(clicked()),this,SLOT(onRemoveElement())); 68 42 } 69 43 70 44 QtDialog::IntsQtQuery::~IntsQtQuery() 71 45 { 46 delete(subQuery); 72 47 } 73 48 74 void QtDialog::IntsQtQuery::onUpdate() { 75 dialog->update(); 49 void QtDialog::IntsQtQuery::onSubUpdate() 50 { 51 addButton->setEnabled(subParam->isSet()); 76 52 } 77 53 78 bool QtDialog::IntsQtQuery::handle() { 54 void QtDialog::IntsQtQuery::onElementSelected() { 55 elementSelected(); 56 } 57 58 void QtDialog::IntsQtQuery::onAddElement() { 59 addElement(); 60 } 61 62 void QtDialog::IntsQtQuery::onRemoveElement() { 63 removeElements(); 64 } 65 66 bool QtDialog::IntsQtQuery::handle() 67 { 79 68 if (param.isValid(temp)){ 80 69 param.set(temp); … … 85 74 86 75 76 -
src/UIElements/Qt4/Query/QtQuery.hpp
r324403 r26ac2d 249 249 }; 250 250 251 class QtDialog::IntsQtQuery : public QWidget, public Dialog::IntsQuery {252 Q_OBJECT 253 public: 254 IntsQtQuery(Parameter<std::vector<int> > &, std::string _title, QBoxLayout *_parent,Dialog *_dialog);251 class QtDialog::IntsQtQuery : public QWidget, public Dialog::IntsQuery, public QtQueryList<int> { 252 Q_OBJECT 253 public: 254 IntsQtQuery(Parameter<std::vector<int> > &, std::string _title, QBoxLayout *_parent,Dialog *_dialog); 255 255 virtual ~IntsQtQuery(); 256 256 virtual bool handle(); 257 void IntegerEntered(const QString&); 258 void IntegerSelected(); 259 void AddInteger(); 260 void RemoveInteger(); 261 262 public slots: 263 void onUpdate(); 264 265 private: 266 QBoxLayout *parent; 267 QBoxLayout *thisLayout; 268 QLabel *titleLabel; 269 Dialog *dialog; 257 258 virtual void onSubUpdate(); 259 260 public slots: 261 void onAddElement(); 262 void onRemoveElement(); 263 void onElementSelected(); 264 265 private: 266 IntQtQuery *subQuery; 270 267 }; 271 268
Note:
See TracChangeset
for help on using the changeset viewer.