source: src/UIElements/Qt4/Query/QtQuery.hpp@ 7c9921

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 7c9921 was 7c9921, checked in by Michael Ankele <ankele@…>, 13 years ago

Refactoring: smarter QtQueries won't need pipes

  • derived all xxxQtQuery classes from QWidget (multiple inheritance officially allowed in this particular case)
  • xxxQtQuery uses its own slots

TODO: ListQueries not rewritten yet!

  • Property mode set to 100644
File size: 11.7 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
21class QHBoxLayout;
22class QBoxLayout;
23class QDialogButtonBox;
24class QLabel;
25class QSpinBox;
26class QDoubleSpinBox;
27class QLineEdit;
28class QListWidget;
29class QPushButton;
30class QTableWidget;
31class QTextEdit;
32class QComboBox;
33class QCheckBox;
34class QFileDialog;
35
36// Forward declarations for plumbing
37template<typename T> class QtQueryListPipe;
38class AtomQtQueryPipe;
39class AtomsQtQueryPipe;
40class BooleanQtQueryPipe;
41class RealSpaceMatrixQtQueryPipe;
42class DoubleQtQueryPipe;
43class DoublesQtQueryPipe;
44class ElementQtQueryPipe;
45class ElementsQtQueryPipe;
46class EmptyQtQueryPipe;
47class FileQtQueryPipe;
48class FilesQtQueryPipe;
49class IntQtQueryPipe;
50class MoleculeQtQueryPipe;
51class MoleculesQtQueryPipe;
52class StringQtQueryPipe;
53class StringsQtQueryPipe;
54class UnsignedIntQtQueryPipe;
55class UnsignedIntsQtQueryPipe;
56class VectorQtQueryPipe;
57class VectorsQtQueryPipe;
58class RandomNumberDistribution_ParametersQtQueryPipe;
59
60class QtDialog::AtomQtQuery : public QWidget, public Dialog::AtomQuery {
61 Q_OBJECT
62public:
63 AtomQtQuery(Parameter<const atom *> &, std::string _title, QBoxLayout *_parent,QtDialog *_dialog);
64 virtual ~AtomQtQuery();
65 virtual bool handle();
66
67public slots:
68 void onUpdate(int);
69
70private:
71 QBoxLayout *parent;
72 QBoxLayout *thisLayout;
73 QLabel *titleLabel;
74 QComboBox *inputBox;
75 QtDialog *dialog;
76
77 AtomQtQueryPipe *pipe;
78};
79
80class QtDialog::AtomsQtQuery : public QWidget, public Dialog::AtomsQuery {
81 Q_OBJECT
82public:
83 AtomsQtQuery(Parameter<std::vector<const atom *> > &, std::string _title, QBoxLayout *_parent,QtDialog *_dialog);
84 virtual ~AtomsQtQuery();
85 virtual bool handle();
86
87public slots:
88 void onUpdate();
89
90private:
91 QBoxLayout *parent;
92 QBoxLayout *thisLayout;
93 QLabel *titleLabel;
94 QLabel *inputLabel;
95 QListWidget *inputList;
96 QtDialog *dialog;
97
98 AtomsQtQueryPipe *pipe;
99};
100
101class QtDialog::BooleanQtQuery : public QWidget, public Dialog::BooleanQuery {
102 Q_OBJECT
103public:
104 BooleanQtQuery(Parameter<bool> &, std::string _title, QBoxLayout *_parent, QtDialog *_dialog);
105 virtual ~BooleanQtQuery();
106 virtual bool handle();
107
108public slots:
109 void onUpdate(int);
110
111private:
112 QBoxLayout *parent;
113 QBoxLayout *thisLayout;
114 QLabel *titleLabel;
115 QCheckBox *booleanCheckBox;
116 QtDialog *dialog;
117
118 BooleanQtQueryPipe *pipe;
119};
120
121class QtDialog::RealSpaceMatrixQtQuery : public QWidget, public Dialog::RealSpaceMatrixQuery {
122 Q_OBJECT
123public:
124 RealSpaceMatrixQtQuery(Parameter<RealSpaceMatrix> &, std::string _title, QBoxLayout *_parent,QtDialog *_dialog);
125 virtual ~RealSpaceMatrixQtQuery();
126 virtual bool handle();
127
128public slots:
129 void onUpdate(int, int);
130
131private:
132 QBoxLayout *parent;
133 QBoxLayout *thisLayout;
134 QLabel *titleLabel;
135 QTableWidget *inputTable;
136 QtDialog *dialog;
137
138 RealSpaceMatrixQtQueryPipe *pipe;
139};
140
141class QtDialog::DoubleQtQuery : public QWidget, public Dialog::DoubleQuery {
142 Q_OBJECT
143public:
144 DoubleQtQuery(Parameter<double> &, std::string title,QBoxLayout *_parent,QtDialog *_dialog);
145 virtual ~DoubleQtQuery();
146 virtual bool handle();
147
148public slots:
149 void onUpdate(double);
150
151private:
152 QBoxLayout *parent;
153 QBoxLayout *thisLayout;
154 QLabel *titleLabel;
155 QDoubleSpinBox *inputBox;
156 QtDialog *dialog;
157
158 DoubleQtQueryPipe *pipe;
159};
160
161class QtDialog::DoublesQtQuery : public QWidget, public Dialog::DoublesQuery {
162 Q_OBJECT
163public:
164 DoublesQtQuery(Parameter<std::vector<double> > &, std::string title,QBoxLayout *_parent,QtDialog *_dialog);
165 virtual ~DoublesQtQuery();
166 virtual bool handle();
167
168public slots:
169 void onUpdate();
170
171private:
172 QBoxLayout *parent;
173 QBoxLayout *thisLayout;
174 QLabel *titleLabel;
175 QDoubleSpinBox *inputBox;
176 QtDialog *dialog;
177
178 QtQueryListPipe<double> *pipe;
179};
180
181class QtDialog::ElementQtQuery : public QWidget, public Dialog::ElementQuery {
182 Q_OBJECT
183public:
184 ElementQtQuery(Parameter<const element *> &, std::string _title, QBoxLayout *_parent, QtDialog *_dialog);
185 virtual ~ElementQtQuery();
186 virtual bool handle();
187
188public slots:
189 void onUpdate(int);
190
191private:
192 QBoxLayout *parent;
193 QBoxLayout *thisLayout;
194 QLabel *titleLabel;
195 QComboBox *inputBox;
196 QtDialog *dialog;
197
198 ElementQtQueryPipe *pipe;
199};
200
201class QtDialog::ElementsQtQuery : public QWidget, public Dialog::ElementsQuery {
202 Q_OBJECT
203public:
204 ElementsQtQuery(Parameter<std::vector<const element *> > &, std::string _title, QBoxLayout *_parent, QtDialog *_dialog);
205 virtual ~ElementsQtQuery();
206 virtual bool handle();
207
208public slots:
209 void onUpdate();
210
211private:
212 QBoxLayout *parent;
213 QBoxLayout *thisLayout;
214 QLabel *titleLabel;
215 QComboBox *inputBox;
216 QtDialog *dialog;
217
218 ElementsQtQueryPipe *pipe;
219};
220
221class QtDialog::EmptyQtQuery : public Dialog::EmptyQuery {
222public:
223 EmptyQtQuery(std::string _title, QBoxLayout *_parent, QtDialog *_dialog);
224 virtual ~EmptyQtQuery();
225 virtual bool handle();
226private:
227 QBoxLayout *parent;
228 QBoxLayout *thisLayout;
229 QLabel *titleLabel;
230 QtDialog *dialog;
231
232 EmptyQtQueryPipe *pipe;
233};
234
235class QtDialog::FileQtQuery : public QWidget, public Dialog::FileQuery {
236 Q_OBJECT
237public:
238 FileQtQuery(Parameter<boost::filesystem::path> &, std::string _title, QBoxLayout *_parent, QtDialog *_dialog);
239 virtual ~FileQtQuery();
240 virtual bool handle();
241
242public slots:
243 void onUpdate();
244 void showFileDialog();
245
246private:
247 QBoxLayout *parent;
248 QBoxLayout *thisLayout;
249 QLabel *filenameLabel;
250 QLineEdit *filenameLineEdit;
251 QPushButton *filedialogButton;
252 QFileDialog *theFileDialog;
253 QtDialog *dialog;
254
255 FileQtQueryPipe *pipe;
256};
257
258class QtDialog::FilesQtQuery : public QWidget, public Dialog::FilesQuery {
259 Q_OBJECT
260public:
261 FilesQtQuery(Parameter<std::vector< boost::filesystem::path> > &, std::string _title, QBoxLayout *_parent, QtDialog *_dialog);
262 virtual ~FilesQtQuery();
263 virtual bool handle();
264 void IntegerEntered(const QString&);
265 void IntegerSelected();
266 void AddInteger();
267 void RemoveInteger();
268
269public slots:
270 void onUpdate();
271
272private:
273 QBoxLayout *parent;
274 QBoxLayout *thisLayout;
275 QLabel *titleLabel;
276 QtDialog *dialog;
277
278 QtQueryListPipe<boost::filesystem::path> *pipe;
279};
280
281class QtDialog::IntQtQuery : public QWidget, public Dialog::IntQuery {
282 Q_OBJECT
283public:
284 IntQtQuery(Parameter<int> &, std::string _title,QBoxLayout *_parent,QtDialog *_dialog);
285 virtual ~IntQtQuery();
286 virtual bool handle();
287
288public slots:
289 void onUpdate(int);
290
291private:
292 QBoxLayout *parent;
293 QBoxLayout *thisLayout;
294 QLabel *titleLabel;
295 QSpinBox *inputBox;
296 QtDialog *dialog;
297
298 IntQtQueryPipe *pipe;
299};
300
301class QtDialog::IntsQtQuery : public QWidget, public Dialog::IntsQuery {
302 Q_OBJECT
303public:
304 IntsQtQuery(Parameter<std::vector<int> > &, std::string _title,QBoxLayout *_parent,QtDialog *_dialog);
305 virtual ~IntsQtQuery();
306 virtual bool handle();
307 void IntegerEntered(const QString&);
308 void IntegerSelected();
309 void AddInteger();
310 void RemoveInteger();
311
312public slots:
313 void onUpdate();
314
315private:
316 QBoxLayout *parent;
317 QBoxLayout *thisLayout;
318 QLabel *titleLabel;
319 QtDialog *dialog;
320
321 QtQueryListPipe<int> *pipe;
322};
323
324class QtDialog::MoleculeQtQuery : public QWidget, public Dialog::MoleculeQuery {
325 Q_OBJECT
326public:
327 MoleculeQtQuery(Parameter<const molecule *> &, std::string _title, QBoxLayout *_parent,QtDialog *_dialog);
328 virtual ~MoleculeQtQuery();
329 virtual bool handle();
330
331public slots:
332 void onUpdate(int);
333
334private:
335 QBoxLayout *parent;
336 QBoxLayout *thisLayout;
337 QLabel *titleLabel;
338 QComboBox *inputBox;
339 QtDialog *dialog;
340
341 MoleculeQtQueryPipe *pipe;
342};
343
344class QtDialog::MoleculesQtQuery : public QWidget, public Dialog::MoleculesQuery {
345 Q_OBJECT
346public:
347 MoleculesQtQuery(Parameter<std::vector<const molecule *> > &, std::string _title, QBoxLayout *_parent,QtDialog *_dialog);
348 virtual ~MoleculesQtQuery();
349 virtual bool handle();
350
351public slots:
352 void onUpdate();
353
354private:
355 QBoxLayout *parent;
356 QBoxLayout *thisLayout;
357 QLabel *titleLabel;
358 QComboBox *inputBox;
359 QtDialog *dialog;
360
361 MoleculesQtQueryPipe *pipe;
362};
363
364class QtDialog::StringQtQuery : public QWidget, public Dialog::StringQuery {
365 Q_OBJECT
366public:
367 StringQtQuery(Parameter<std::string> &, std::string _title, QBoxLayout *_parent,QtDialog *_dialog);
368 virtual ~StringQtQuery();
369 virtual bool handle();
370
371public slots:
372 void onUpdate(const QString&);
373
374private:
375 QBoxLayout *parent;
376 QBoxLayout *thisLayout;
377 QLabel *titleLabel;
378 QLineEdit *inputBox;
379 QtDialog *dialog;
380
381 StringQtQueryPipe *pipe;
382};
383
384class QtDialog::StringsQtQuery : public QWidget, public Dialog::StringsQuery {
385 Q_OBJECT
386public:
387 StringsQtQuery(Parameter<std::vector<std::string> > &, std::string _title, QBoxLayout *_parent,QtDialog *_dialog);
388 virtual ~StringsQtQuery();
389 virtual bool handle();
390
391public slots:
392 void onUpdate();
393
394private:
395 QBoxLayout *parent;
396 QBoxLayout *thisLayout;
397 QLabel *titleLabel;
398 QLineEdit *inputBox;
399 QtDialog *dialog;
400
401 StringsQtQueryPipe *pipe;
402};
403
404class QtDialog::UnsignedIntQtQuery : public QWidget, public Dialog::UnsignedIntQuery {
405 Q_OBJECT
406public:
407 UnsignedIntQtQuery(Parameter<unsigned int> &, std::string _title,QBoxLayout *_parent,QtDialog *_dialog);
408 virtual ~UnsignedIntQtQuery();
409 virtual bool handle();
410
411public slots:
412 void onUpdate(unsigned int);
413
414private:
415 QBoxLayout *parent;
416 QBoxLayout *thisLayout;
417 QLabel *titleLabel;
418 QSpinBox *inputBox;
419 QtDialog *dialog;
420
421 UnsignedIntQtQueryPipe *pipe;
422};
423
424class QtDialog::UnsignedIntsQtQuery : public QWidget, public Dialog::UnsignedIntsQuery {
425 Q_OBJECT
426public:
427 UnsignedIntsQtQuery(Parameter<std::vector<unsigned int> > &, std::string _title,QBoxLayout *_parent,QtDialog *_dialog);
428 virtual ~UnsignedIntsQtQuery();
429 virtual bool handle();
430 void IntegerEntered(const QString&);
431 void IntegerSelected();
432 void AddInteger();
433 void RemoveInteger();
434
435public slots:
436 void onUpdate();
437
438private:
439 QBoxLayout *parent;
440 QBoxLayout *thisLayout;
441 QLabel *titleLabel;
442 QtDialog *dialog;
443
444 QtQueryListPipe<unsigned int> *pipe;
445};
446
447
448class QtDialog::VectorQtQuery : public QWidget, public Dialog::VectorQuery {
449 Q_OBJECT
450public:
451 VectorQtQuery(Parameter<Vector> &, std::string title,QBoxLayout *,QtDialog *);
452 virtual ~VectorQtQuery();
453 virtual bool handle();
454
455public slots:
456 void onUpdateX(double);
457 void onUpdateY(double);
458 void onUpdateZ(double);
459
460private:
461 QBoxLayout *parent;
462 QBoxLayout *mainLayout;
463 QLabel *titleLabel;
464 QBoxLayout *subLayout;
465 QBoxLayout *coordLayout;
466 QLabel *coordLabel;
467 QDoubleSpinBox *coordInputX;
468 QDoubleSpinBox *coordInputY;
469 QDoubleSpinBox *coordInputZ;
470 QtDialog *dialog;
471
472 VectorQtQueryPipe *pipe;
473};
474
475class QtDialog::VectorsQtQuery : public QWidget, public Dialog::VectorsQuery {
476 Q_OBJECT
477public:
478 VectorsQtQuery(Parameter<std::vector<Vector> > &, std::string title,QBoxLayout *,QtDialog *);
479 virtual ~VectorsQtQuery();
480 virtual bool handle();
481
482public slots:
483 void onUpdate();
484
485private:
486 QBoxLayout *parent;
487 QBoxLayout *mainLayout;
488 QLabel *titleLabel;
489 QBoxLayout *subLayout;
490 QBoxLayout *coordLayout;
491 QLabel *coordLabel;
492 QDoubleSpinBox *coordInput;
493 QtDialog *dialog;
494
495 VectorsQtQueryPipe *pipe;
496};
497
498class QtDialog::RandomNumberDistribution_ParametersQtQuery : public QWidget, public Dialog::RandomNumberDistribution_ParametersQuery {
499 Q_OBJECT
500public:
501 RandomNumberDistribution_ParametersQtQuery(Parameter<RandomNumberDistribution_Parameters> &, std::string title,QBoxLayout *,QtDialog *);
502 virtual ~RandomNumberDistribution_ParametersQtQuery();
503 virtual bool handle();
504
505public slots:
506 void onUpdate();
507
508private:
509 QBoxLayout *parent;
510 QHBoxLayout *thisLayout;
511 QLabel *titleLabel;
512 QTextEdit *inputBox;
513 QPushButton *okButton;
514 QtDialog *dialog;
515
516 RandomNumberDistribution_ParametersQtQueryPipe *pipe;
517};
518
519#endif /* QTQUERY_HPP_ */
Note: See TracBrowser for help on using the repository browser.