Changeset cbf01e for src/UIElements/QT4


Ignore:
Timestamp:
Feb 25, 2010, 2:23:33 PM (15 years ago)
Author:
Tillmann Crueger <crueger@…>
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:
2561df
Parents:
326a43b (diff), 5a7243 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'MenuRefactoring' into QT4Refactoring

Conflicts:

molecuilder/src/Actions/Process.cpp
molecuilder/src/Actions/Process.hpp
molecuilder/src/Actions/small_actions.hpp
molecuilder/src/Makefile.am
molecuilder/src/UIElements/TextDialog.cpp
molecuilder/src/World.cpp
molecuilder/src/unittests/Makefile.am

Location:
src/UIElements/QT4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/QT4/QTDialog.cpp

    r326a43b rcbf01e  
    2121#include <Qt/qcombobox.h>
    2222
     23#include "World.hpp"
     24#include "periodentafel.hpp"
    2325#include "atom.hpp"
     26#include "element.hpp"
    2427#include "molecule.hpp"
    2528
     
    9598}
    9699
     100void QTDialog::queryElement(const char* title, element **target){
     101  registerQuery(new ElementQTQuery(title,target,inputLayout,this));
     102}
     103
    97104/************************** Query Objects *******************************/
    98105
     
    192199  for(iter  = molecules->ListOfMolecules.begin();
    193200      iter != molecules->ListOfMolecules.end();
    194       iter++) {
     201      ++iter) {
    195202    stringstream sstr;
    196203    sstr << (*iter)->IndexNr << "\t" << (*iter)->getName();
     
    255262
    256263
     264QTDialog::ElementQTQuery::ElementQTQuery(std::string _title, element **_target, QBoxLayout *_parent, QTDialog *_dialog) :
     265    Dialog::ElementQuery(_title,_target),
     266    parent(_parent)
     267{
     268  periodentafel *periode = World::get()->getPeriode();
     269  thisLayout = new QHBoxLayout();
     270  titleLabel = new QLabel(QString(getTitle().c_str()));
     271  inputBox = new QComboBox();
     272  element* Elemental = 0;
     273  for(Elemental = periode->start->next;
     274      Elemental!=periode->end;
     275      Elemental = Elemental->next)
     276  {
     277    stringstream sstr;
     278    sstr << Elemental->Z << "\t" << Elemental->name;
     279    inputBox->addItem(QString(sstr.str().c_str()),QVariant(Elemental->Z));
     280  }
     281  parent->addLayout(thisLayout);
     282  thisLayout->addWidget(titleLabel);
     283  thisLayout->addWidget(inputBox);
     284
     285  pipe = new ElementQTQueryPipe(&tmp,_dialog,inputBox);
     286  pipe->update(inputBox->currentIndex());
     287  connect(inputBox,SIGNAL(currentIndexChanged(int)),pipe,SLOT(update(int)));
     288}
     289
     290QTDialog::ElementQTQuery::~ElementQTQuery()
     291{
     292  delete pipe;
     293}
     294
     295bool QTDialog::ElementQTQuery::handle(){
     296  return true;
     297}
     298
    257299/*************************** Plumbing *******************************/
    258300
     
    313355}
    314356
     357ElementQTQueryPipe::ElementQTQueryPipe(element **_content, QTDialog *_dialog, QComboBox *_theBox) :
     358  content(_content),
     359  dialog(_dialog),
     360  theBox(_theBox)
     361{}
     362
     363ElementQTQueryPipe::~ElementQTQueryPipe()
     364{}
     365
     366void ElementQTQueryPipe::update(int newIndex) {
     367  QVariant data = theBox->itemData(newIndex);
     368  int idx = data.toInt();
     369  (*content) = World::get()->getPeriode()->FindElement(idx);
     370  dialog->update();
     371}
     372
  • src/UIElements/QT4/QTDialog.hpp

    r326a43b rcbf01e  
    2626class DoubleQTQueryPipe;
    2727class MoleculeQTQueryPipe;
     28class ElementQTQueryPipe;
    2829
    2930class QTDialog : public QDialog, public Dialog
     
    3940  virtual void queryMolecule(const char*,molecule**,MoleculeListClass*);
    4041  virtual void queryVector(const char*,Vector *,const double *const,bool);
     42  virtual void queryElement(const char*,element **);
    4143
    4244  virtual bool display();
     
    4850    public:
    4951      IntQTQuery(std::string _title, int *_target,QBoxLayout *_parent,QTDialog *_dialog);
    50       ~IntQTQuery();
     52      virtual ~IntQTQuery();
    5153      virtual bool handle();
    5254    private:
     
    6264    public:
    6365      DoubleQTQuery(std::string title, double *_target,QBoxLayout *_parent,QTDialog *_dialog);
    64       ~DoubleQTQuery();
     66      virtual ~DoubleQTQuery();
    6567      virtual bool handle();
    6668    private:
     
    7678    public:
    7779      StringQTQuery(std::string _title, std::string *_target, QBoxLayout *_parent,QTDialog *_dialog);
    78       ~StringQTQuery();
     80      virtual ~StringQTQuery();
    7981      virtual bool handle();
    8082    private:
     
    9092    public:
    9193      MoleculeQTQuery(std::string _title, molecule **_target, MoleculeListClass *_molecules, QBoxLayout *_parent,QTDialog *_dialog);
    92       ~MoleculeQTQuery();
     94      virtual ~MoleculeQTQuery();
    9395      virtual bool handle();
    9496    private:
     
    104106    public:
    105107      VectorQTQuery(std::string title,Vector *_target,const double *const _cellSize,bool _check,QBoxLayout *,QTDialog *);
    106       ~VectorQTQuery();
     108      virtual ~VectorQTQuery();
    107109      virtual bool handle();
    108110    private:
     
    118120    };
    119121
     122    class ElementQTQuery : public Dialog::ElementQuery {
     123    public:
     124      ElementQTQuery(std::string _title, element **_target, QBoxLayout *_parent, QTDialog *_dialog);
     125      virtual ~ElementQTQuery();
     126      virtual bool handle();
     127    private:
     128      QBoxLayout *parent;
     129      QBoxLayout *thisLayout;
     130      QLabel *titleLabel;
     131      QComboBox *inputBox;
     132
     133      ElementQTQueryPipe *pipe;
     134    };
     135
    120136private:
    121137  QBoxLayout *mainLayout;
     
    133149public:
    134150  StringQTQueryPipe(std::string *_content, QTDialog *_dialog);
    135   ~StringQTQueryPipe();
     151  virtual ~StringQTQueryPipe();
    136152
    137153public slots:
     
    148164public:
    149165  IntQTQueryPipe(int *_content, QTDialog *_dialog);
    150   ~IntQTQueryPipe();
     166  virtual ~IntQTQueryPipe();
    151167
    152168public slots:
     
    163179public:
    164180  DoubleQTQueryPipe(double *_content, QTDialog *_dialog);
    165   ~DoubleQTQueryPipe();
     181  virtual ~DoubleQTQueryPipe();
    166182
    167183public slots:
     
    178194public:
    179195  MoleculeQTQueryPipe(molecule **_content, QTDialog *_dialog, QComboBox *_theBox, MoleculeListClass *_molecules);
    180   ~MoleculeQTQueryPipe();
     196  virtual ~MoleculeQTQueryPipe();
    181197
    182198public slots:
     
    190206
    191207};
     208
     209class ElementQTQueryPipe : public QWidget {
     210  Q_OBJECT
     211public:
     212  ElementQTQueryPipe(element **_content, QTDialog *_dialog, QComboBox *_theBox);
     213  virtual ~ElementQTQueryPipe();
     214
     215public slots:
     216  void update(int);
     217
     218private:
     219  element **content;
     220  QTDialog *dialog;
     221  QComboBox *theBox;
     222};
    192223#endif /* QTDIALOG_HPP_ */
Note: See TracChangeset for help on using the changeset viewer.