Ignore:
Timestamp:
Jul 24, 2012, 3:19:01 PM (13 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:
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)
Message:

QtQueryList added (only used in StringsQtQuery yet)

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

Legend:

Unmodified
Added
Removed
  • TabularUnified src/UIElements/Qt4/Query/QtQuery.hpp

    r7dfd07 r7b8a8e  
    1818#include "Qt4/QtDialog.hpp"
    1919#include "Parameters/Parameter.hpp"
     20#include "QtQueryList.hpp"
    2021
    2122class QHBoxLayout;
     
    326327};
    327328
    328 class QtDialog::StringsQtQuery : public QWidget, public Dialog::StringsQuery {
     329class QtDialog::StringsQtQuery : public QWidget, public Dialog::StringsQuery, public QtQueryList<std::string> {
    329330  Q_OBJECT
    330331public:
     
    333334  virtual bool handle();
    334335
    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
     338public slots:
     339  void onAddElement();
     340  void onRemoveElement();
     341  void onElementSelected();
     342
     343private:
     344  StringQtQuery *subQuery;
    344345};
    345346
  • TabularUnified src/UIElements/Qt4/Query/StringsQtQuery.cpp

    r7dfd07 r7b8a8e  
    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::StringsQtQuery::StringsQtQuery(Parameter<std::vector<std::string> > &_param, std::string _title,QBoxLayout *_parent,Dialog *_dialog) :
    3332    Dialog::StringsQuery(_param, _title),
    34     parent(_parent),
    35     dialog(_dialog)
     33    QtQueryList<std::string>(_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 StringQtQuery(*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 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()));
    6842}
    6943
    7044QtDialog::StringsQtQuery::~StringsQtQuery()
    7145{
     46  delete(subQuery);
    7247}
    7348
    74 void QtDialog::StringsQtQuery::onUpdate() {
    75   dialog->update();
     49void QtDialog::StringsQtQuery::onSubUpdate()
     50{
     51  addButton->setEnabled(subParam->isSet());
     52}
     53
     54void QtDialog::StringsQtQuery::onElementSelected() {
     55  elementSelected();
     56}
     57
     58void QtDialog::StringsQtQuery::onAddElement() {
     59  addElement();
     60}
     61
     62void QtDialog::StringsQtQuery::onRemoveElement() {
     63  removeElements();
    7664}
    7765
     
    7967bool QtDialog::StringsQtQuery::handle()
    8068{
    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 also
    91     temp_strings.push_back(std::string(olditer, temp.end()));
    92   tmp.set(temp_strings);
    93 
    94   return temp!="";*/
    9569  if (param.isValid(temp)){
    9670    param.set(temp);
Note: See TracChangeset for help on using the changeset viewer.