Changeset 7b8a8e for src/UIElements/Qt4/Query
- Timestamp:
- Jul 24, 2012, 3:19:01 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:
- a2aa2f
- Parents:
- 7dfd07
- git-author:
- Michael Ankele <ankele@…> (07/24/12 13:28:39)
- git-committer:
- Michael Ankele <ankele@…> (07/24/12 15:19:01)
- Location:
- src/UIElements/Qt4/Query
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/UIElements/Qt4/Query/QtQuery.hpp ¶
r7dfd07 r7b8a8e 18 18 #include "Qt4/QtDialog.hpp" 19 19 #include "Parameters/Parameter.hpp" 20 #include "QtQueryList.hpp" 20 21 21 22 class QHBoxLayout; … … 326 327 }; 327 328 328 class QtDialog::StringsQtQuery : public QWidget, public Dialog::StringsQuery {329 class QtDialog::StringsQtQuery : public QWidget, public Dialog::StringsQuery, public QtQueryList<std::string> { 329 330 Q_OBJECT 330 331 public: … … 333 334 virtual bool handle(); 334 335 335 public slots: 336 void onUpdate(); 337 338 private: 339 QBoxLayout *parent;340 QBoxLayout *thisLayout;341 QLabel *titleLabel; 342 QLineEdit *inputBox; 343 Dialog *dialog;336 virtual void onSubUpdate(); 337 338 public slots: 339 void onAddElement(); 340 void onRemoveElement(); 341 void onElementSelected(); 342 343 private: 344 StringQtQuery *subQuery; 344 345 }; 345 346 -
TabularUnified src/UIElements/Qt4/Query/StringsQtQuery.cpp ¶
r7dfd07 r7b8a8e 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::StringsQtQuery::StringsQtQuery(Parameter<std::vector<std::string> > &_param, std::string _title,QBoxLayout *_parent,Dialog *_dialog) : 33 32 Dialog::StringsQuery(_param, _title), 34 parent(_parent), 35 dialog(_dialog) 33 QtQueryList<std::string>(_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 StringQtQuery(*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 StringsQtQueryPipe(temp,_dialog,inputBox,inputList,AddButton,RemoveButton); 64 connect(inputBox,SIGNAL(textChanged(const QString&)),pipe,SLOT(elementEntered(const QString&))); 65 connect(inputList,SIGNAL(itemSelectionChanged()),pipe,SLOT(elementSelected())); 66 connect(AddButton,SIGNAL(clicked()),pipe,SLOT(addElement())); 67 connect(RemoveButton,SIGNAL(clicked()),pipe,SLOT(removeElement()));*/ 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::StringsQtQuery::~StringsQtQuery() 71 45 { 46 delete(subQuery); 72 47 } 73 48 74 void QtDialog::StringsQtQuery::onUpdate() { 75 dialog->update(); 49 void QtDialog::StringsQtQuery::onSubUpdate() 50 { 51 addButton->setEnabled(subParam->isSet()); 52 } 53 54 void QtDialog::StringsQtQuery::onElementSelected() { 55 elementSelected(); 56 } 57 58 void QtDialog::StringsQtQuery::onAddElement() { 59 addElement(); 60 } 61 62 void QtDialog::StringsQtQuery::onRemoveElement() { 63 removeElements(); 76 64 } 77 65 … … 79 67 bool QtDialog::StringsQtQuery::handle() 80 68 { 81 /* // dissect by ","82 std::string::iterator olditer = temp.begin();83 std::vector<std::string> temp_strings;84 for(std::string::iterator iter = temp.begin(); iter != temp.end(); ++iter) {85 if (*iter == ' ') {86 temp_strings.push_back(std::string(iter, olditer));87 olditer = iter;88 }89 }90 if (olditer != temp.begin()) // insert last part also91 temp_strings.push_back(std::string(olditer, temp.end()));92 tmp.set(temp_strings);93 94 return temp!="";*/95 69 if (param.isValid(temp)){ 96 70 param.set(temp);
Note:
See TracChangeset
for help on using the changeset viewer.