source: src/UIElements/Qt4/Query/QtQuery.hpp@ c32d21

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
Last change on this file since c32d21 was dae158, checked in by Frederik Heber <heber@…>, 11 years ago

FileQtQuery retrieves valid suffixes from validators.

  • added getFlatListFromHierarchyOfValidators() that steps through the hierarchy of validators and generates a flat vector with all matching types.
  • Or_Validatorm Not_Validator::getA(), ::getB() added. (present for And_... already).
  • FileSuffixValidator::getSuffix(), ParserFileValidator::getSuffixes() added.
  • Property mode set to 100644
File size: 11.2 KB
RevLine 
[308aa4]1/*
2 * QtQuery.hpp
3 *
4 * Created on: Nov 8, 2010
5 * Author: heber
6 */
7
8#ifndef QTQUERY_HPP_
9#define QTQUERY_HPP_
10
[56f73b]11// include config.h
12#ifdef HAVE_CONFIG_H
13#include <config.h>
14#endif
15
16
[7c9921]17#include <Qt/qwidget.h>
[308aa4]18#include "Qt4/QtDialog.hpp"
[f10b0c]19#include "Parameters/Parameter.hpp"
[7b8a8e]20#include "QtQueryList.hpp"
[308aa4]21
[0275ad]22class QHBoxLayout;
[a5ddf0]23class QBoxLayout;
24class QDialogButtonBox;
25class QLabel;
26class QSpinBox;
27class QDoubleSpinBox;
28class QLineEdit;
29class QListWidget;
[0275ad]30class QPushButton;
[a5ddf0]31class QTableWidget;
[0275ad]32class QTextEdit;
[a5ddf0]33class QComboBox;
[85b112]34class QCheckBox;
[7c9921]35class QFileDialog;
[a5ddf0]36
[852ea3]37template<class T>
38class QtQuery : public Dialog::TQuery<T>
39{
40public:
[f130d4]41 QtQuery(Parameter<T> &_param, const std::string &_title, const std::string &_description = "") :
42 Dialog::TQuery<T>(_param, _title, _description) {}
[852ea3]43 // QtQueries are interactive - no need for handle().
44 virtual bool handle(){ return true; }
45};
46
47class QtDialog::AtomQtQuery : public QWidget, public QtQuery<const atom *> {
[7c9921]48 Q_OBJECT
[308aa4]49public:
[f130d4]50 AtomQtQuery(Parameter<const atom *> &, const std::string &_title, const std::string &description, QBoxLayout *_parent,Dialog *_dialog);
[308aa4]51 virtual ~AtomQtQuery();
[7c9921]52
53public slots:
54 void onUpdate(int);
55
[308aa4]56private:
57 QBoxLayout *parent;
58 QBoxLayout *thisLayout;
59 QLabel *titleLabel;
60 QComboBox *inputBox;
[7dfd07]61 Dialog *dialog;
[308aa4]62};
63
[852ea3]64class QtDialog::AtomsQtQuery : public QWidget, public QtQuery<std::vector<const atom *> >, public QtQueryList<const atom *> {
[7c9921]65 Q_OBJECT
[308aa4]66public:
[f130d4]67 AtomsQtQuery(Parameter<std::vector<const atom *> > &, const std::string &_title, const std::string &description, QBoxLayout *_parent,Dialog *_dialog);
[308aa4]68 virtual ~AtomsQtQuery();
[7c9921]69
[2f4e81]70 virtual void onSubUpdate();
71
[7c9921]72public slots:
[2f4e81]73 void onAddElement();
74 void onRemoveElement();
75 void onElementSelected();
[7c9921]76
[308aa4]77private:
[2f4e81]78 AtomQtQuery *subQuery;
[308aa4]79};
80
[852ea3]81class QtDialog::BooleanQtQuery : public QWidget, public QtQuery<bool> {
[7c9921]82 Q_OBJECT
[308aa4]83public:
[f130d4]84 BooleanQtQuery(Parameter<bool> &, const std::string &_title, const std::string &description, QBoxLayout *_parent, Dialog *_dialog);
[308aa4]85 virtual ~BooleanQtQuery();
[7c9921]86
87public slots:
88 void onUpdate(int);
89
[308aa4]90private:
91 QBoxLayout *parent;
92 QBoxLayout *thisLayout;
93 QLabel *titleLabel;
[85b112]94 QCheckBox *booleanCheckBox;
[7dfd07]95 Dialog *dialog;
[308aa4]96};
97
[852ea3]98class QtDialog::RealSpaceMatrixQtQuery : public QWidget, public QtQuery<RealSpaceMatrix> {
[7c9921]99 Q_OBJECT
[308aa4]100public:
[f130d4]101 RealSpaceMatrixQtQuery(Parameter<RealSpaceMatrix> &, const std::string &_title, const std::string &description, QBoxLayout *_parent,Dialog *_dialog);
[7d9416]102 virtual ~RealSpaceMatrixQtQuery();
[7c9921]103
104public slots:
105 void onUpdate(int, int);
106
[308aa4]107private:
108 QBoxLayout *parent;
109 QBoxLayout *thisLayout;
110 QLabel *titleLabel;
111 QTableWidget *inputTable;
[7dfd07]112 Dialog *dialog;
[308aa4]113};
114
[852ea3]115class QtDialog::DoubleQtQuery : public QWidget, public QtQuery<double> {
[7c9921]116 Q_OBJECT
[308aa4]117public:
[f130d4]118 DoubleQtQuery(Parameter<double> &, const std::string &_title, const std::string &_description,QBoxLayout *_parent,Dialog *_dialog);
[308aa4]119 virtual ~DoubleQtQuery();
[7c9921]120
121public slots:
122 void onUpdate(double);
123
[308aa4]124private:
125 QBoxLayout *parent;
126 QBoxLayout *thisLayout;
127 QLabel *titleLabel;
128 QDoubleSpinBox *inputBox;
[7dfd07]129 Dialog *dialog;
[308aa4]130};
131
[852ea3]132class QtDialog::DoublesQtQuery : public QWidget, public QtQuery<std::vector<double> >, public QtQueryList<double> {
[7c9921]133 Q_OBJECT
[308aa4]134public:
[f130d4]135 DoublesQtQuery(Parameter<std::vector<double> > &, const std::string &_title, const std::string &description, QBoxLayout *_parent,Dialog *_dialog);
[308aa4]136 virtual ~DoublesQtQuery();
[7c9921]137
[7e8e79]138 virtual void onSubUpdate();
139
[7c9921]140public slots:
[7e8e79]141 void onAddElement();
142 void onRemoveElement();
143 void onElementSelected();
[7c9921]144
[308aa4]145private:
[7e8e79]146 DoubleQtQuery *subQuery;
[308aa4]147};
148
[852ea3]149class QtDialog::ElementQtQuery : public QWidget, public QtQuery<const element *> {
[7c9921]150 Q_OBJECT
[308aa4]151public:
[f130d4]152 ElementQtQuery(Parameter<const element *> &, const std::string &_title, const std::string &description, QBoxLayout *_parent, Dialog *_dialog);
[308aa4]153 virtual ~ElementQtQuery();
[7c9921]154
155public slots:
156 void onUpdate(int);
157
[308aa4]158private:
159 QBoxLayout *parent;
160 QBoxLayout *thisLayout;
161 QLabel *titleLabel;
162 QComboBox *inputBox;
[7dfd07]163 Dialog *dialog;
[308aa4]164};
165
[852ea3]166class QtDialog::ElementsQtQuery : public QWidget, public QtQuery<std::vector<const element *> >, public QtQueryList<const element *> {
[7c9921]167 Q_OBJECT
[308aa4]168public:
[f130d4]169 ElementsQtQuery(Parameter<std::vector<const element *> > &, const std::string &_title, const std::string &description, QBoxLayout *_parent,Dialog *_dialog);
[308aa4]170 virtual ~ElementsQtQuery();
[7c9921]171
[572701]172 virtual void onSubUpdate();
173
[7c9921]174public slots:
[572701]175 void onAddElement();
176 void onRemoveElement();
177 void onElementSelected();
[7c9921]178
[308aa4]179private:
[572701]180 ElementQtQuery *subQuery;
[308aa4]181};
182
183class QtDialog::EmptyQtQuery : public Dialog::EmptyQuery {
184public:
[f130d4]185 EmptyQtQuery(const std::string &_title, const std::string &description, QBoxLayout *_parent, Dialog *_dialog);
[308aa4]186 virtual ~EmptyQtQuery();
187 virtual bool handle();
188private:
189 QBoxLayout *parent;
190 QBoxLayout *thisLayout;
191 QLabel *titleLabel;
[7dfd07]192 Dialog *dialog;
[308aa4]193};
194
[852ea3]195class QtDialog::FileQtQuery : public QWidget, public QtQuery<boost::filesystem::path> {
[7c9921]196 Q_OBJECT
[308aa4]197public:
[f130d4]198 FileQtQuery(Parameter<boost::filesystem::path> &, const std::string &_title, const std::string &description, QBoxLayout *_parent, Dialog *_dialog);
[308aa4]199 virtual ~FileQtQuery();
[7c9921]200
201public slots:
202 void onUpdate();
203 void showFileDialog();
204
[308aa4]205private:
206 QBoxLayout *parent;
207 QBoxLayout *thisLayout;
208 QLabel *filenameLabel;
209 QLineEdit *filenameLineEdit;
210 QPushButton *filedialogButton;
[7c9921]211 QFileDialog *theFileDialog;
[7dfd07]212 Dialog *dialog;
[dae158]213 std::vector<std::string> suffixes;
214 bool mustBePresent;
[308aa4]215};
216
[852ea3]217class QtDialog::FilesQtQuery : public QWidget, public QtQuery<std::vector<boost::filesystem::path> >, public QtQueryList<boost::filesystem::path> {
[7c9921]218 Q_OBJECT
[2c5765]219public:
[f130d4]220 FilesQtQuery(Parameter<std::vector<boost::filesystem::path> > &, const std::string &_title, const std::string &description, QBoxLayout *_parent,Dialog *_dialog);
[2c5765]221 virtual ~FilesQtQuery();
[324403]222
223 virtual void onSubUpdate();
[7c9921]224
225public slots:
[324403]226 void onAddElement();
227 void onRemoveElement();
228 void onElementSelected();
[7c9921]229
[2c5765]230private:
[324403]231 FileQtQuery *subQuery;
[2c5765]232};
233
[852ea3]234class QtDialog::IntQtQuery : public QWidget, public QtQuery<int> {
[7c9921]235 Q_OBJECT
[308aa4]236public:
[f130d4]237 IntQtQuery(Parameter<int> &, const std::string &_title, const std::string &description,QBoxLayout *_parent,Dialog *_dialog);
[308aa4]238 virtual ~IntQtQuery();
[7c9921]239
240public slots:
241 void onUpdate(int);
242
[308aa4]243private:
244 QBoxLayout *parent;
245 QBoxLayout *thisLayout;
246 QLabel *titleLabel;
247 QSpinBox *inputBox;
[7dfd07]248 Dialog *dialog;
[308aa4]249};
250
[852ea3]251class QtDialog::IntsQtQuery : public QWidget, public QtQuery<std::vector<int> >, public QtQueryList<int> {
[7c9921]252 Q_OBJECT
[308aa4]253public:
[f130d4]254 IntsQtQuery(Parameter<std::vector<int> > &, const std::string &_title, const std::string &description, QBoxLayout *_parent,Dialog *_dialog);
[308aa4]255 virtual ~IntsQtQuery();
[26ac2d]256
257 virtual void onSubUpdate();
[7c9921]258
259public slots:
[26ac2d]260 void onAddElement();
261 void onRemoveElement();
262 void onElementSelected();
[7c9921]263
[308aa4]264private:
[26ac2d]265 IntQtQuery *subQuery;
[308aa4]266};
267
[852ea3]268class QtDialog::MoleculeQtQuery : public QWidget, public QtQuery<const molecule *> {
[7c9921]269 Q_OBJECT
[308aa4]270public:
[f130d4]271 MoleculeQtQuery(Parameter<const molecule *> &, const std::string &_title, const std::string &description, QBoxLayout *_parent,Dialog *_dialog);
[308aa4]272 virtual ~MoleculeQtQuery();
[7c9921]273
274public slots:
275 void onUpdate(int);
276
[308aa4]277private:
278 QBoxLayout *parent;
279 QBoxLayout *thisLayout;
280 QLabel *titleLabel;
281 QComboBox *inputBox;
[7dfd07]282 Dialog *dialog;
[308aa4]283};
284
[852ea3]285class QtDialog::MoleculesQtQuery : public QWidget, public QtQuery<std::vector<const molecule *> >, public QtQueryList<const molecule *> {
[7c9921]286 Q_OBJECT
[308aa4]287public:
[f130d4]288 MoleculesQtQuery(Parameter<std::vector<const molecule *> > &, const std::string &_title, const std::string &description, QBoxLayout *_parent,Dialog *_dialog);
[308aa4]289 virtual ~MoleculesQtQuery();
[7c9921]290
[1ae820]291 virtual void onSubUpdate();
292
[7c9921]293public slots:
[1ae820]294 void onAddElement();
295 void onRemoveElement();
296 void onElementSelected();
[7c9921]297
[308aa4]298private:
[1ae820]299 MoleculeQtQuery *subQuery;
[308aa4]300};
301
[852ea3]302class QtDialog::StringQtQuery : public QWidget, public QtQuery<std::string> {
[7c9921]303 Q_OBJECT
[308aa4]304public:
[f130d4]305 StringQtQuery(Parameter<std::string> &, const std::string &_title, const std::string &description, QBoxLayout *_parent,Dialog *_dialog);
[308aa4]306 virtual ~StringQtQuery();
[7c9921]307
308public slots:
309 void onUpdate(const QString&);
[dbf6c7]310 void onUpdateCombo(int index);
[7c9921]311
[308aa4]312private:
313 QBoxLayout *parent;
314 QBoxLayout *thisLayout;
315 QLabel *titleLabel;
316 QLineEdit *inputBox;
[dbf6c7]317 QComboBox *comboBox;
[7dfd07]318 Dialog *dialog;
[308aa4]319};
320
[852ea3]321class QtDialog::StringsQtQuery : public QWidget, public QtQuery<std::vector<std::string> >, public QtQueryList<std::string> {
[7c9921]322 Q_OBJECT
[308aa4]323public:
[f130d4]324 StringsQtQuery(Parameter<std::vector<std::string> > &, const std::string &_title, const std::string &description, QBoxLayout *_parent,Dialog *_dialog);
[308aa4]325 virtual ~StringsQtQuery();
[7c9921]326
[7b8a8e]327 virtual void onSubUpdate();
328
[7c9921]329public slots:
[7b8a8e]330 void onAddElement();
331 void onRemoveElement();
332 void onElementSelected();
[7c9921]333
[308aa4]334private:
[7b8a8e]335 StringQtQuery *subQuery;
[308aa4]336};
337
[852ea3]338class QtDialog::UnsignedIntQtQuery : public QWidget, public QtQuery<unsigned int> {
[7c9921]339 Q_OBJECT
[838cd0]340public:
[f130d4]341 UnsignedIntQtQuery(Parameter<unsigned int> &, const std::string &_title, const std::string &description,QBoxLayout *_parent,Dialog *_dialog);
[838cd0]342 virtual ~UnsignedIntQtQuery();
[7c9921]343
344public slots:
[a2aa2f]345 void onUpdate(int);
[7c9921]346
[838cd0]347private:
348 QBoxLayout *parent;
349 QBoxLayout *thisLayout;
350 QLabel *titleLabel;
351 QSpinBox *inputBox;
[7dfd07]352 Dialog *dialog;
[838cd0]353};
354
[852ea3]355class QtDialog::UnsignedIntsQtQuery : public QWidget, public QtQuery<std::vector<unsigned int> >, public QtQueryList<unsigned int> {
[7c9921]356 Q_OBJECT
[12948c]357public:
[f130d4]358 UnsignedIntsQtQuery(Parameter<std::vector<unsigned int> > &, const std::string &_title, const std::string &description, QBoxLayout *_parent,Dialog *_dialog);
[12948c]359 virtual ~UnsignedIntsQtQuery();
[a2aa2f]360
361 virtual void onSubUpdate();
[7c9921]362
363public slots:
[a2aa2f]364 void onAddElement();
365 void onRemoveElement();
366 void onElementSelected();
[7c9921]367
[12948c]368private:
[a2aa2f]369 UnsignedIntQtQuery *subQuery;
[12948c]370};
371
[852ea3]372class QtDialog::VectorQtQuery : public QWidget, public QtQuery<Vector> {
[7c9921]373 Q_OBJECT
[308aa4]374public:
[f130d4]375 VectorQtQuery(Parameter<Vector> &, const std::string &_title, const std::string &_description,QBoxLayout *,Dialog *);
[308aa4]376 virtual ~VectorQtQuery();
[7c9921]377
378public slots:
379 void onUpdateX(double);
380 void onUpdateY(double);
381 void onUpdateZ(double);
382
[308aa4]383private:
384 QBoxLayout *parent;
385 QBoxLayout *mainLayout;
386 QLabel *titleLabel;
387 QBoxLayout *subLayout;
388 QBoxLayout *coordLayout;
389 QLabel *coordLabel;
[a14fe3]390 QDoubleSpinBox *coordInputX;
391 QDoubleSpinBox *coordInputY;
392 QDoubleSpinBox *coordInputZ;
[7dfd07]393 Dialog *dialog;
[308aa4]394};
395
[852ea3]396class QtDialog::VectorsQtQuery : public QWidget, public QtQuery<std::vector<Vector> >, public QtQueryList<Vector> {
[7c9921]397 Q_OBJECT
[308aa4]398public:
[f130d4]399 VectorsQtQuery(Parameter<std::vector<Vector> > &, const std::string &_title, const std::string &description, QBoxLayout *_parent,Dialog *_dialog);
[308aa4]400 virtual ~VectorsQtQuery();
[7c9921]401
[f84992]402 virtual void onSubUpdate();
403
[7c9921]404public slots:
[f84992]405 void onAddElement();
406 void onRemoveElement();
407 void onElementSelected();
[7c9921]408
[308aa4]409private:
[f84992]410 VectorQtQuery *subQuery;
[308aa4]411};
412
[852ea3]413class QtDialog::RandomNumberDistribution_ParametersQtQuery : public QWidget, public QtQuery<RandomNumberDistribution_Parameters> {
[7c9921]414 Q_OBJECT
[0275ad]415public:
[f130d4]416 RandomNumberDistribution_ParametersQtQuery(Parameter<RandomNumberDistribution_Parameters> &, const std::string &_title, const std::string &_description,QBoxLayout *,Dialog *);
[0275ad]417 virtual ~RandomNumberDistribution_ParametersQtQuery();
[7c9921]418
419public slots:
420 void onUpdate();
421
[0275ad]422private:
423 QBoxLayout *parent;
424 QHBoxLayout *thisLayout;
425 QLabel *titleLabel;
426 QTextEdit *inputBox;
427 QPushButton *okButton;
[7dfd07]428 Dialog *dialog;
[0275ad]429};
430
[308aa4]431#endif /* QTQUERY_HPP_ */
Note: See TracBrowser for help on using the repository browser.