Changeset 2f4e81 for src/UIElements/Qt4


Ignore:
Timestamp:
Jul 24, 2012, 3:21:01 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:
1ae820
Parents:
7e8e79
git-author:
Michael Ankele <ankele@…> (07/24/12 14:46:07)
git-committer:
Michael Ankele <ankele@…> (07/24/12 15:21:01)
Message:

QtQueryList applied to AtomsQtQuery

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

Legend:

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

    r7e8e79 r2f4e81  
    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"
    29 #include "UIElements/Qt4/Pipe/AtomsQtQueryPipe.hpp"
    30 
    31 #include "Atom/atom.hpp"
    32 #include "World.hpp"
     27#include "UIElements/Qt4/Query/QtQueryList.hpp"
     28#include "UIElements/Qt4/Pipe/QtQueryListPipe.hpp"
    3329
    3430
    3531QtDialog::AtomsQtQuery::AtomsQtQuery(Parameter<std::vector<const atom *> > &_param, std::string _title,QBoxLayout *_parent,Dialog *_dialog) :
    3632    Dialog::AtomsQuery(_param, _title),
    37     parent(_parent),
    38     dialog(_dialog)
     33    QtQueryList<const atom *>(_parent, _dialog, temp)
    3934{
    40   QHBoxLayout * thisHLayout = new QHBoxLayout();
    41   QVBoxLayout * thisV1Layout = new QVBoxLayout();
    42   QVBoxLayout * thisV2Layout = new QVBoxLayout();
     35  ListQuerySubDialog *subDialog = new ListQuerySubDialog(this);
     36  subQuery = new AtomQtQuery(*subParam, _title, thisVLayout, subDialog);
     37  subDialog->setSubQuery(subQuery);
    4338
    44   titleLabel = new QLabel(QString(getTitle().c_str()));
    45   inputLabel = new QLabel("Enter to add");
    46   inputList = new QListWidget();
    47   inputList->setSelectionMode(QAbstractItemView::ExtendedSelection);
    48   std::vector<atom *> atoms = World::getInstance().getAllAtoms();
    49   for (std::vector<atom *>::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter)
    50     inputList->insertItem((*iter)->getNr(),QString((*iter)->getNr()));
    51 
    52   QLineEdit* inputBox = new QLineEdit();
    53   inputLabel->setBuddy(inputBox);
    54   titleLabel->setBuddy(inputList);
    55   QPushButton* AddButton = new QPushButton("Add");
    56   AddButton->setEnabled(false);
    57   QPushButton* RemoveButton = new QPushButton("Remove");
    58   RemoveButton->setEnabled(false);
    59 
    60   thisV1Layout->addWidget(titleLabel);
    61   thisV1Layout->addWidget(inputList);
    62   thisV2Layout->addWidget(inputLabel);
    63   thisV2Layout->addWidget(inputBox);
    64   thisV2Layout->addWidget(AddButton);
    65   thisV2Layout->addWidget(RemoveButton);
    66   parent->addLayout(thisHLayout);
    67   thisHLayout->addLayout(thisV1Layout);
    68   thisHLayout->addLayout(thisV2Layout);
    69 
    70   /*connect(inputList,SIGNAL(itemSelectionChanged()),pipe,SLOT(IntegerSelected()));
    71   connect(AddButton,SIGNAL(Clicked()),pipe,SLOT(add()));
    72   connect(RemoveButton,SIGNAL(Clicked()),pipe,SLOT(remove()));*/
     39  connect(inputList,SIGNAL(itemSelectionChanged()),this,SLOT(onElementSelected()));
     40  connect(addButton,SIGNAL(clicked()),this,SLOT(onAddElement()));
     41  connect(removeButton,SIGNAL(clicked()),this,SLOT(onRemoveElement()));
    7342}
    7443
    7544QtDialog::AtomsQtQuery::~AtomsQtQuery()
    7645{
     46  delete(subQuery);
    7747}
    7848
    79 void QtDialog::AtomsQtQuery::onUpdate() {
    80   dialog->update();
     49void QtDialog::AtomsQtQuery::onSubUpdate()
     50{
     51  addButton->setEnabled(subParam->isSet());
    8152}
    8253
    83 bool QtDialog::AtomsQtQuery::handle() {
     54void QtDialog::AtomsQtQuery::onElementSelected() {
     55  elementSelected();
     56}
     57
     58void QtDialog::AtomsQtQuery::onAddElement() {
     59  addElement();
     60}
     61
     62void QtDialog::AtomsQtQuery::onRemoveElement() {
     63  removeElements();
     64}
     65
     66bool QtDialog::AtomsQtQuery::handle()
     67{
    8468  if (param.isValid(temp)){
    8569    param.set(temp);
     
    8973}
    9074
     75
     76
  • src/UIElements/Qt4/Query/QtQuery.hpp

    r7e8e79 r2f4e81  
    5353};
    5454
    55 class QtDialog::AtomsQtQuery : public QWidget, public Dialog::AtomsQuery {
     55class QtDialog::AtomsQtQuery : public QWidget, public Dialog::AtomsQuery, public QtQueryList<const atom *> {
    5656  Q_OBJECT
    5757public:
     
    6060  virtual bool handle();
    6161
    62 public slots:
    63   void onUpdate();
    64 
    65 private:
    66   QBoxLayout *parent;
    67   QBoxLayout *thisLayout;
    68   QLabel *titleLabel;
    69   QLabel *inputLabel;
    70   QListWidget *inputList;
    71   Dialog *dialog;
     62  virtual void onSubUpdate();
     63
     64public slots:
     65  void onAddElement();
     66  void onRemoveElement();
     67  void onElementSelected();
     68
     69private:
     70  AtomQtQuery *subQuery;
    7271};
    7372
Note: See TracChangeset for help on using the changeset viewer.