Changeset 1ae820 for src/UIElements/Qt4


Ignore:
Timestamp:
Jul 24, 2012, 3:21:17 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:
08e137
Parents:
2f4e81
git-author:
Michael Ankele <ankele@…> (07/24/12 14:50:05)
git-committer:
Michael Ankele <ankele@…> (07/24/12 15:21:17)
Message:

QtQueryList applied to MoleculesQtQuery

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

Legend:

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

    r2f4e81 r1ae820  
    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
    2626#include "UIElements/Qt4/Query/QtQuery.hpp"
    27 #include "UIElements/Qt4/Pipe/MoleculesQtQueryPipe.hpp"
    28 
    29 #include "molecule.hpp"
    30 #include "World.hpp"
     27#include "UIElements/Qt4/Query/QtQueryList.hpp"
     28#include "UIElements/Qt4/Pipe/QtQueryListPipe.hpp"
    3129
    3230
    33 QtDialog::MoleculesQtQuery::MoleculesQtQuery(Parameter<std::vector<const molecule *> > &_param, std::string _title, QBoxLayout *_parent,Dialog *_dialog) :
     31QtDialog::MoleculesQtQuery::MoleculesQtQuery(Parameter<std::vector<const molecule *> > &_param, std::string _title,QBoxLayout *_parent,Dialog *_dialog) :
    3432    Dialog::MoleculesQuery(_param, _title),
    35     parent(_parent),
    36     dialog(_dialog)
     33    QtQueryList<const molecule *>(_parent, _dialog, temp)
    3734{
    38   thisLayout = new QHBoxLayout();
    39   titleLabel = new QLabel(QString(getTitle().c_str()));
    40   inputBox = new QComboBox();
    41   // add all molecules to the combo box
    42   vector<molecule*> molecules = World::getInstance().getAllMolecules();
    43   for(vector<molecule*>::iterator iter  = molecules.begin();
    44       iter != molecules.end();
    45       ++iter) {
    46     std::stringstream sstr;
    47     sstr << (*iter)->IndexNr << "\t" << (*iter)->getName();
    48     inputBox->addItem(QString(sstr.str().c_str()),QVariant((*iter)->IndexNr));
    49   }
    50   parent->addLayout(thisLayout);
    51   thisLayout->addWidget(titleLabel);
    52   thisLayout->addWidget(inputBox);
     35  ListQuerySubDialog *subDialog = new ListQuerySubDialog(this);
     36  subQuery = new MoleculeQtQuery(*subParam, _title, thisVLayout, subDialog);
     37  subDialog->setSubQuery(subQuery);
    5338
    54   /*pipe = new MoleculesQtQueryPipe(temp,_dialog,inputBox);
    55   pipe->update(inputBox->currentIndex());
    56   connect(inputBox,SIGNAL(currentIndexChanged(int)),pipe,SLOT(update(int)));*/
     39  connect(inputList,SIGNAL(itemSelectionChanged()),this,SLOT(onElementSelected()));
     40  connect(addButton,SIGNAL(clicked()),this,SLOT(onAddElement()));
     41  connect(removeButton,SIGNAL(clicked()),this,SLOT(onRemoveElement()));
    5742}
    5843
    5944QtDialog::MoleculesQtQuery::~MoleculesQtQuery()
    6045{
     46  delete(subQuery);
    6147}
    6248
    63 void QtDialog::MoleculesQtQuery::onUpdate() {
    64   dialog->update();
     49void QtDialog::MoleculesQtQuery::onSubUpdate()
     50{
     51  addButton->setEnabled(subParam->isSet());
    6552}
    6653
    67 // Handling is easy, since the GUI makes it impossible to select invalid values
     54void QtDialog::MoleculesQtQuery::onElementSelected() {
     55  elementSelected();
     56}
     57
     58void QtDialog::MoleculesQtQuery::onAddElement() {
     59  addElement();
     60}
     61
     62void QtDialog::MoleculesQtQuery::onRemoveElement() {
     63  removeElements();
     64}
     65
    6866bool QtDialog::MoleculesQtQuery::handle()
    6967{
     
    7573}
    7674
     75
     76
  • src/UIElements/Qt4/Query/QtQuery.hpp

    r2f4e81 r1ae820  
    284284};
    285285
    286 class QtDialog::MoleculesQtQuery : public QWidget, public Dialog::MoleculesQuery {
     286class QtDialog::MoleculesQtQuery : public QWidget, public Dialog::MoleculesQuery, public QtQueryList<const molecule *> {
    287287  Q_OBJECT
    288288public:
     
    291291  virtual bool handle();
    292292
    293 public slots:
    294   void onUpdate();
    295 
    296 private:
    297   QBoxLayout *parent;
    298   QBoxLayout *thisLayout;
    299   QLabel *titleLabel;
    300   QComboBox *inputBox;
    301   Dialog *dialog;
     293  virtual void onSubUpdate();
     294
     295public slots:
     296  void onAddElement();
     297  void onRemoveElement();
     298  void onElementSelected();
     299
     300private:
     301  MoleculeQtQuery *subQuery;
    302302};
    303303
Note: See TracChangeset for help on using the changeset viewer.