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

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