Changeset 572701 for src/UIElements/Qt4


Ignore:
Timestamp:
Jul 24, 2012, 3:20:03 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:
324403
Parents:
f84992
git-author:
Michael Ankele <ankele@…> (07/24/12 14:08:40)
git-committer:
Michael Ankele <ankele@…> (07/24/12 15:20:03)
Message:

QtQueryList applied to ElementsQtQuery

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

Legend:

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

    rf84992 r572701  
    1818#endif
    1919
     20#include <Qt/qpushbutton.h>
    2021#include <Qt/qboxlayout.h>
    21 #include <Qt/qcombobox.h>
    22 #include <Qt/qlabel.h>
     22#include <Qt/qlistwidget.h>
    2323
    2424#include "CodePatterns/MemDebug.hpp"
    2525
     26
    2627#include "UIElements/Qt4/Query/QtQuery.hpp"
    27 #include "UIElements/Qt4/Pipe/ElementsQtQueryPipe.hpp"
    28 
    29 #include "Element/element.hpp"
    30 #include "Element/periodentafel.hpp"
    31 #include "World.hpp"
     28#include "UIElements/Qt4/Query/QtQueryList.hpp"
     29#include "UIElements/Qt4/Pipe/QtQueryListPipe.hpp"
    3230
    3331
    34 QtDialog::ElementsQtQuery::ElementsQtQuery(Parameter<std::vector<const element *> > &_param, std::string _title, QBoxLayout *_parent, Dialog *_dialog) :
     32QtDialog::ElementsQtQuery::ElementsQtQuery(Parameter<std::vector<const element *> > &_param, std::string _title,QBoxLayout *_parent,Dialog *_dialog) :
    3533    Dialog::ElementsQuery(_param, _title),
    36     parent(_parent),
    37     dialog(_dialog)
     34    QtQueryList<const element *>(_parent, _dialog, temp)
    3835{
    39   periodentafel *periode = World::getInstance().getPeriode();
    40   thisLayout = new QHBoxLayout();
    41   titleLabel = new QLabel(QString(getTitle().c_str()));
    42   inputBox = new QComboBox();
    43   for(periodentafel::const_iterator iter = periode->begin();
    44       iter!=periode->end();
    45       ++iter)
    46   {
    47     std::stringstream sstr;
    48     sstr << (*iter).first << "\t" << (*iter).second->getName();
    49     inputBox->addItem(QString(sstr.str().c_str()),QVariant((*iter).first));
    50   }
    51   parent->addLayout(thisLayout);
    52   thisLayout->addWidget(titleLabel);
    53   thisLayout->addWidget(inputBox);
     36  ListQuerySubDialog *subDialog = new ListQuerySubDialog(this);
     37  subQuery = new ElementQtQuery(*subParam, _title, thisVLayout, subDialog);
     38  subDialog->setSubQuery(subQuery);
    5439
    55   /*pipe = new ElementsQtQueryPipe(temp,_dialog,inputBox);
    56   pipe->update(inputBox->currentIndex());
    57   connect(inputBox,SIGNAL(currentIndexChanged(int)),pipe,SLOT(update(int)));*/
     40  connect(inputList,SIGNAL(itemSelectionChanged()),this,SLOT(onElementSelected()));
     41  connect(addButton,SIGNAL(clicked()),this,SLOT(onAddElement()));
     42  connect(removeButton,SIGNAL(clicked()),this,SLOT(onRemoveElement()));
    5843}
    5944
    6045QtDialog::ElementsQtQuery::~ElementsQtQuery()
    6146{
     47  delete(subQuery);
    6248}
    6349
    64 void QtDialog::ElementsQtQuery::onUpdate() {
    65   dialog->update();
     50void QtDialog::ElementsQtQuery::onSubUpdate()
     51{
     52  addButton->setEnabled(subParam->isSet());
    6653}
    6754
    68 bool QtDialog::ElementsQtQuery::handle(){
     55void QtDialog::ElementsQtQuery::onElementSelected() {
     56  elementSelected();
     57}
     58
     59void QtDialog::ElementsQtQuery::onAddElement() {
     60  addElement();
     61}
     62
     63void QtDialog::ElementsQtQuery::onRemoveElement() {
     64  removeElements();
     65}
     66
     67bool QtDialog::ElementsQtQuery::handle()
     68{
    6969  if (param.isValid(temp)){
    7070    param.set(temp);
     
    7474}
    7575
     76
  • src/UIElements/Qt4/Query/QtQuery.hpp

    rf84992 r572701  
    162162};
    163163
    164 class QtDialog::ElementsQtQuery : public QWidget, public Dialog::ElementsQuery {
    165   Q_OBJECT
    166 public:
    167   ElementsQtQuery(Parameter<std::vector<const element *> > &, std::string _title, QBoxLayout *_parent, Dialog *_dialog);
     164class QtDialog::ElementsQtQuery : public QWidget, public Dialog::ElementsQuery, public QtQueryList<const element *> {
     165  Q_OBJECT
     166public:
     167  ElementsQtQuery(Parameter<std::vector<const element *> > &, std::string _title, QBoxLayout *_parent,Dialog *_dialog);
    168168  virtual ~ElementsQtQuery();
    169169  virtual bool handle();
    170170
    171 public slots:
    172   void onUpdate();
    173 
    174 private:
    175   QBoxLayout *parent;
    176   QBoxLayout *thisLayout;
    177   QLabel *titleLabel;
    178   QComboBox *inputBox;
    179   Dialog *dialog;
     171  virtual void onSubUpdate();
     172
     173public slots:
     174  void onAddElement();
     175  void onRemoveElement();
     176  void onElementSelected();
     177
     178private:
     179  ElementQtQuery *subQuery;
    180180};
    181181
Note: See TracChangeset for help on using the changeset viewer.