Changeset 26ac2d for src/UIElements/Qt4


Ignore:
Timestamp:
Jul 24, 2012, 3:20:31 PM (12 years ago)
Author:
Michael Ankele <ankele@…>
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)
Message:

QtQueryList applied to IntsQtQuery

Location:
src/UIElements/Qt4/Query
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/Qt4/Query/IntsQtQuery.cpp

    r324403 r26ac2d  
    1818#endif
    1919
     20#include <Qt/qpushbutton.h>
    2021#include <Qt/qboxlayout.h>
    21 #include <Qt/qlabel.h>
    22 #include <Qt/qlineedit.h>
    2322#include <Qt/qlistwidget.h>
    24 #include <Qt/qpushbutton.h>
    2523
    2624#include "CodePatterns/MemDebug.hpp"
    2725
    2826#include "UIElements/Qt4/Query/QtQuery.hpp"
     27#include "UIElements/Qt4/Query/QtQueryList.hpp"
    2928#include "UIElements/Qt4/Pipe/QtQueryListPipe.hpp"
    3029
     
    3231QtDialog::IntsQtQuery::IntsQtQuery(Parameter<std::vector<int> > &_param, std::string _title,QBoxLayout *_parent,Dialog *_dialog) :
    3332    Dialog::IntsQuery(_param, _title),
    34     parent(_parent),
    35     dialog(_dialog)
     33    QtQueryList<int>(_parent, _dialog, temp)
    3634{
    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);
    4038
    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()));
    6842}
    6943
    7044QtDialog::IntsQtQuery::~IntsQtQuery()
    7145{
     46  delete(subQuery);
    7247}
    7348
    74 void QtDialog::IntsQtQuery::onUpdate() {
    75   dialog->update();
     49void QtDialog::IntsQtQuery::onSubUpdate()
     50{
     51  addButton->setEnabled(subParam->isSet());
    7652}
    7753
    78 bool QtDialog::IntsQtQuery::handle() {
     54void QtDialog::IntsQtQuery::onElementSelected() {
     55  elementSelected();
     56}
     57
     58void QtDialog::IntsQtQuery::onAddElement() {
     59  addElement();
     60}
     61
     62void QtDialog::IntsQtQuery::onRemoveElement() {
     63  removeElements();
     64}
     65
     66bool QtDialog::IntsQtQuery::handle()
     67{
    7968  if (param.isValid(temp)){
    8069    param.set(temp);
     
    8574
    8675
     76
  • src/UIElements/Qt4/Query/QtQuery.hpp

    r324403 r26ac2d  
    249249};
    250250
    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);
     251class QtDialog::IntsQtQuery : public QWidget, public Dialog::IntsQuery, public QtQueryList<int> {
     252  Q_OBJECT
     253public:
     254  IntsQtQuery(Parameter<std::vector<int> > &, std::string _title, QBoxLayout *_parent,Dialog *_dialog);
    255255  virtual ~IntsQtQuery();
    256256  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
     260public slots:
     261  void onAddElement();
     262  void onRemoveElement();
     263  void onElementSelected();
     264
     265private:
     266  IntQtQuery *subQuery;
    270267};
    271268
Note: See TracChangeset for help on using the changeset viewer.