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

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 136842 was 33e801, checked in by Frederik Heber <heber@…>, 10 years ago

Added ParameterPair (i.e. "key = value;") to allow other string output.

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