source: src/UIElements/QT4/QTDialog.hpp@ bcf653

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 bcf653 was e5c0a1, checked in by Tillmann Crueger <crueger@…>, 14 years ago

Made the periodentafel return only "const element *" instead of "element * const", to avoid unexpected changes to stored elements

  • Note: returning "type * const" from a function does not make sense, since the pointer has to be copied anyway (calling convention), so the calling function can just do another copy to get a non const version of the pointer
  • Property mode set to 100644
File size: 11.2 KB
RevLine 
[d3a5ea]1/*
2 * QTDialog.hpp
3 *
4 * Created on: Jan 18, 2010
5 * Author: crueger
6 */
7
8#ifndef QTDIALOG_HPP_
9#define QTDIALOG_HPP_
10
11#include "UIElements/Dialog.hpp"
[cef1d7]12#include <QtGui/QDialog>
[d3a5ea]13
14class QBoxLayout;
15class QLabel;
16class QSpinBox;
[b8d1aeb]17class QDoubleSpinBox;
[d3a5ea]18class QLineEdit;
[7cd6e7]19class QListWidget;
[d3a5ea]20class QComboBox;
21class QDialogButtonBox;
22
23
24// Forward declarations for plumbing
[7cd6e7]25template<typename T> class QTQueryListPipe;
[d3a5ea]26class StringQTQueryPipe;
[7cd6e7]27class StringsQTQueryPipe;
[d3a5ea]28class IntQTQueryPipe;
[b8d1aeb]29class DoubleQTQueryPipe;
[7cd6e7]30class DoublesQTQueryPipe;
31class AtomQTQueryPipe;
32class AtomsQTQueryPipe;
[d3a5ea]33class MoleculeQTQueryPipe;
[7cd6e7]34class MoleculesQTQueryPipe;
[cbf01e]35class ElementQTQueryPipe;
[7cd6e7]36class ElementsQTQueryPipe;
37class VectorQTQueryPipe;
38class VectorsQTQueryPipe;
[d3a5ea]39
40class QTDialog : public QDialog, public Dialog
41{
42 Q_OBJECT
43public:
44 QTDialog();
45 virtual ~QTDialog();
46
[257c77]47 virtual void queryEmpty(const char*, std::string);
[3731b4]48 virtual void queryBoolean(const char *, std::string = "");
49 virtual void queryInt(const char *,std::string = "");
[7cd6e7]50 virtual void queryInts(const char *,std::string = "");
[3731b4]51 virtual void queryDouble(const char*,std::string = "");
[7cd6e7]52 virtual void queryDoubles(const char*,std::string = "");
[3731b4]53 virtual void queryString(const char*,std::string = "");
54 virtual void queryStrings(const char*,std::string = "");
55 virtual void queryAtom(const char*,std::string = "");
[7cd6e7]56 virtual void queryAtoms(const char*,std::string = "");
[3731b4]57 virtual void queryMolecule(const char*,std::string = "");
[7cd6e7]58 virtual void queryMolecules(const char*,std::string = "");
[3731b4]59 virtual void queryVector(const char*,bool,std::string = "");
[7cd6e7]60 virtual void queryVectors(const char*,bool,std::string = "");
[3731b4]61 virtual void queryBox(const char*, std::string = "");
62 virtual void queryElement(const char*,std::string = "");
[7cd6e7]63 virtual void queryElements(const char*,std::string = "");
[d3a5ea]64
65 virtual bool display();
66
67 virtual void update();
68
69protected:
70 class IntQTQuery : public Dialog::IntQuery {
71 public:
[3731b4]72 IntQTQuery(std::string _title,QBoxLayout *_parent,QTDialog *_dialog);
[cbf01e]73 virtual ~IntQTQuery();
[d3a5ea]74 virtual bool handle();
75 private:
76 QBoxLayout *parent;
77 QBoxLayout *thisLayout;
78 QLabel *titleLabel;
79 QSpinBox *inputBox;
80
81 IntQTQueryPipe *pipe;
82 };
83
[7cd6e7]84 class IntsQTQuery : public Dialog::IntsQuery {
85 public:
86 IntsQTQuery(std::string _title,QBoxLayout *_parent,QTDialog *_dialog);
87 virtual ~IntsQTQuery();
88 virtual bool handle();
89 void IntegerEntered(const QString&);
90 void IntegerSelected();
91 void AddInteger();
92 void RemoveInteger();
93 private:
94 QBoxLayout *parent;
95 QBoxLayout *thisLayout;
96 QLabel *titleLabel;
97
98 QTQueryListPipe<int> *pipe;
99 };
100
[b8d1aeb]101 class DoubleQTQuery : public Dialog::DoubleQuery {
102 public:
[3731b4]103 DoubleQTQuery(std::string title,QBoxLayout *_parent,QTDialog *_dialog);
[cbf01e]104 virtual ~DoubleQTQuery();
[b8d1aeb]105 virtual bool handle();
106 private:
107 QBoxLayout *parent;
108 QBoxLayout *thisLayout;
109 QLabel *titleLabel;
110 QDoubleSpinBox *inputBox;
111
112 DoubleQTQueryPipe *pipe;
113 };
114
[7cd6e7]115 class DoublesQTQuery : public Dialog::DoublesQuery {
116 public:
117 DoublesQTQuery(std::string title,QBoxLayout *_parent,QTDialog *_dialog);
118 virtual ~DoublesQTQuery();
119 virtual bool handle();
120 private:
121 QBoxLayout *parent;
122 QBoxLayout *thisLayout;
123 QLabel *titleLabel;
124 QDoubleSpinBox *inputBox;
125
126 QTQueryListPipe<double> *pipe;
127 };
128
[d3a5ea]129 class StringQTQuery : public Dialog::StringQuery {
130 public:
[3731b4]131 StringQTQuery(std::string _title, QBoxLayout *_parent,QTDialog *_dialog);
[cbf01e]132 virtual ~StringQTQuery();
[d3a5ea]133 virtual bool handle();
134 private:
135 QBoxLayout *parent;
136 QBoxLayout *thisLayout;
[cd8e55]137 QLabel *titleLabel;
138 QLineEdit *inputBox;
139
140 StringQTQueryPipe *pipe;
141 };
142
143 class StringsQTQuery : public Dialog::StringsQuery {
144 public:
[3731b4]145 StringsQTQuery(std::string _title, QBoxLayout *_parent,QTDialog *_dialog);
[cd8e55]146 virtual ~StringsQTQuery();
147 virtual bool handle();
148 private:
149 QBoxLayout *parent;
[d3a5ea]150 QBoxLayout *thisLayout;
151 QLabel *titleLabel;
152 QLineEdit *inputBox;
153
[7cd6e7]154 QTQueryListPipe<std::string> *pipe;
155 };
156
157 class AtomQTQuery : public Dialog::AtomQuery {
158 public:
159 AtomQTQuery(std::string _title, QBoxLayout *_parent,QTDialog *_dialog);
160 virtual ~AtomQTQuery();
161 virtual bool handle();
162 private:
163 QBoxLayout *parent;
164 QBoxLayout *thisLayout;
165 QLabel *titleLabel;
166 QComboBox *inputBox;
167
168 AtomQTQueryPipe *pipe;
169 };
170
171 class AtomsQTQuery : public Dialog::AtomsQuery {
172 public:
173 AtomsQTQuery(std::string _title, QBoxLayout *_parent,QTDialog *_dialog);
174 virtual ~AtomsQTQuery();
175 virtual bool handle();
176 private:
177 QBoxLayout *parent;
178 QBoxLayout *thisLayout;
179 QLabel *titleLabel;
180 QComboBox *inputBox;
181
182 AtomsQTQueryPipe *pipe;
[d3a5ea]183 };
184
185 class MoleculeQTQuery : public Dialog::MoleculeQuery {
186 public:
[3731b4]187 MoleculeQTQuery(std::string _title, QBoxLayout *_parent,QTDialog *_dialog);
[cbf01e]188 virtual ~MoleculeQTQuery();
[d3a5ea]189 virtual bool handle();
190 private:
191 QBoxLayout *parent;
192 QBoxLayout *thisLayout;
193 QLabel *titleLabel;
194 QComboBox *inputBox;
195
196 MoleculeQTQueryPipe *pipe;
197 };
198
[7cd6e7]199 class MoleculesQTQuery : public Dialog::MoleculesQuery {
200 public:
201 MoleculesQTQuery(std::string _title, QBoxLayout *_parent,QTDialog *_dialog);
202 virtual ~MoleculesQTQuery();
203 virtual bool handle();
204 private:
205 QBoxLayout *parent;
206 QBoxLayout *thisLayout;
207 QLabel *titleLabel;
208 QComboBox *inputBox;
209
210 MoleculesQTQueryPipe *pipe;
211 };
212
[b8d1aeb]213 class VectorQTQuery : public Dialog::VectorQuery {
214 public:
[3731b4]215 VectorQTQuery(std::string title,bool _check,QBoxLayout *,QTDialog *);
[cbf01e]216 virtual ~VectorQTQuery();
[b8d1aeb]217 virtual bool handle();
218 private:
219 QBoxLayout *parent;
220 QBoxLayout *mainLayout;
221 QLabel *titleLabel;
222 QBoxLayout *subLayout;
[7cd6e7]223 QBoxLayout *coordLayout;
224 QLabel *coordLabel;
225 QDoubleSpinBox *coordInput;
226
227 VectorQTQueryPipe *pipe;
228 };
229
230 class VectorsQTQuery : public Dialog::VectorsQuery {
231 public:
232 VectorsQTQuery(std::string title,bool _check,QBoxLayout *,QTDialog *);
233 virtual ~VectorsQTQuery();
234 virtual bool handle();
235 private:
236 QBoxLayout *parent;
237 QBoxLayout *mainLayout;
238 QLabel *titleLabel;
239 QBoxLayout *subLayout;
240 QBoxLayout *coordLayout;
241 QLabel *coordLabel;
242 QDoubleSpinBox *coordInput;
[b8d1aeb]243
[7cd6e7]244 VectorsQTQueryPipe *pipe;
[b8d1aeb]245 };
246
[cbf01e]247 class ElementQTQuery : public Dialog::ElementQuery {
248 public:
[3731b4]249 ElementQTQuery(std::string _title, QBoxLayout *_parent, QTDialog *_dialog);
[cbf01e]250 virtual ~ElementQTQuery();
251 virtual bool handle();
252 private:
253 QBoxLayout *parent;
254 QBoxLayout *thisLayout;
255 QLabel *titleLabel;
256 QComboBox *inputBox;
257
258 ElementQTQueryPipe *pipe;
259 };
260
[7cd6e7]261 class ElementsQTQuery : public Dialog::ElementsQuery {
262 public:
263 ElementsQTQuery(std::string _title, QBoxLayout *_parent, QTDialog *_dialog);
264 virtual ~ElementsQTQuery();
265 virtual bool handle();
266 private:
267 QBoxLayout *parent;
268 QBoxLayout *thisLayout;
269 QLabel *titleLabel;
270 QComboBox *inputBox;
271
272 ElementsQTQueryPipe *pipe;
273 };
274
[d3a5ea]275private:
276 QBoxLayout *mainLayout;
277 QBoxLayout *inputLayout;
278 QBoxLayout *buttonLayout;
279 QDialogButtonBox *buttons;
280};
281
282// All kinds of plumbing for Queries
283// Plumbing needs to be outside of the class where it is needed,
284// since MOC doesn't like nested classes
285
[7cd6e7]286
287template<typename T> class QTQueryListPipe : public QWidget {
288 public:
289 QTQueryListPipe(std::vector<T> *_content, QTDialog *_dialog, QLineEdit *_inputBox, QListWidget *_inputList, QPushButton *_AddButton, QPushButton *_RemoveButton);
290 virtual ~QTQueryListPipe();
291 void AddInteger();
292 void RemoveInteger();
293 void IntegerSelected();
294 void IntegerEntered(const QString&);
295
296 private:
297 void AddValue(T item);
298 void RemoveRow(int row);
299
300 std::vector<T> *content;
301 QTDialog *dialog;
302 QLineEdit *inputBox;
303 QListWidget *inputList;
304 QPushButton *AddButton;
305 QPushButton *RemoveButton;
306};
307
308
[d3a5ea]309class StringQTQueryPipe : public QWidget {
310 Q_OBJECT
311public:
312 StringQTQueryPipe(std::string *_content, QTDialog *_dialog);
[cbf01e]313 virtual ~StringQTQueryPipe();
[d3a5ea]314
315public slots:
316 void update(const QString&);
317
318private:
319 std::string *content;
320 QTDialog *dialog;
321
322};
323
324class IntQTQueryPipe : public QWidget {
325 Q_OBJECT
326public:
327 IntQTQueryPipe(int *_content, QTDialog *_dialog);
[cbf01e]328 virtual ~IntQTQueryPipe();
[d3a5ea]329
330public slots:
331 void update(int);
332
333private:
334 int *content;
335 QTDialog *dialog;
336
337};
338
[7cd6e7]339
[b8d1aeb]340class DoubleQTQueryPipe : public QWidget {
341 Q_OBJECT
342public:
343 DoubleQTQueryPipe(double *_content, QTDialog *_dialog);
[cbf01e]344 virtual ~DoubleQTQueryPipe();
[b8d1aeb]345
346public slots:
347 void update(double);
348
349private:
350 double *content;
351 QTDialog *dialog;
352
353};
[d3a5ea]354
[7cd6e7]355class AtomQTQueryPipe : public QWidget {
356 Q_OBJECT
357public:
358 AtomQTQueryPipe(atom **_content, QTDialog *_dialog, QComboBox *_theBox);
359 virtual ~AtomQTQueryPipe();
360
361public slots:
362 void update(int);
363
364private:
365 atom **content;
366 QTDialog *dialog;
367 QComboBox *theBox;
368
369};
370
371
372class AtomsQTQueryPipe : public QWidget {
373 Q_OBJECT
374public:
375 AtomsQTQueryPipe(std::vector<atom *>*_content, QTDialog *_dialog, QComboBox *_theBox);
376 virtual ~AtomsQTQueryPipe();
377
378public slots:
379 void update(int);
380
381private:
382 std::vector<atom *>*content;
383 QTDialog *dialog;
384 QComboBox *theBox;
385
386};
387
[d3a5ea]388class MoleculeQTQueryPipe : public QWidget {
389 Q_OBJECT
390public:
[257c77]391 MoleculeQTQueryPipe(molecule **_content, QTDialog *_dialog, QComboBox *_theBox);
[cbf01e]392 virtual ~MoleculeQTQueryPipe();
[d3a5ea]393
394public slots:
395 void update(int);
396
397private:
398 molecule **content;
399 QTDialog *dialog;
400 QComboBox *theBox;
401
402};
[cbf01e]403
[7cd6e7]404class MoleculesQTQueryPipe : public QWidget {
405 Q_OBJECT
406public:
407 MoleculesQTQueryPipe(std::vector<molecule *>*_content, QTDialog *_dialog, QComboBox *_theBox);
408 virtual ~MoleculesQTQueryPipe();
409
410public slots:
411 void update(int);
412
413private:
414 std::vector<molecule *>*content;
415 QTDialog *dialog;
416 QComboBox *theBox;
417
418};
419
420class VectorQTQueryPipe : public QWidget {
421 Q_OBJECT
422public:
423 VectorQTQueryPipe(Vector *_content, QTDialog *_dialog, QComboBox *_theBox);
424 virtual ~VectorQTQueryPipe();
425
426public slots:
427 void update();
428
429private:
430 Vector *content;
431 QTDialog *dialog;
432 QComboBox *theBox;
433};
434
435class VectorsQTQueryPipe : public QWidget {
436 Q_OBJECT
437public:
438 VectorsQTQueryPipe(std::vector<Vector>*_content, QTDialog *_dialog, QComboBox *_theBox);
439 virtual ~VectorsQTQueryPipe();
440
441public slots:
442 void update();
443
444private:
445 std::vector<Vector> *content;
446 QTDialog *dialog;
447 QComboBox *theBox;
448};
449
[cbf01e]450class ElementQTQueryPipe : public QWidget {
451 Q_OBJECT
452public:
[e5c0a1]453 ElementQTQueryPipe(const element **_content, QTDialog *_dialog, QComboBox *_theBox);
[cbf01e]454 virtual ~ElementQTQueryPipe();
455
456public slots:
457 void update(int);
458
459private:
[e5c0a1]460 const element **content;
[7cd6e7]461 QTDialog *dialog;
462 QComboBox *theBox;
463};
464
465class ElementsQTQueryPipe : public QWidget {
466 Q_OBJECT
467public:
[e5c0a1]468 ElementsQTQueryPipe(std::vector<const element *>*_content, QTDialog *_dialog, QComboBox *_theBox);
[7cd6e7]469 virtual ~ElementsQTQueryPipe();
470
471public slots:
472 void update(int);
473
474private:
[e5c0a1]475 std::vector<const element *>*content;
[cbf01e]476 QTDialog *dialog;
477 QComboBox *theBox;
478};
[d3a5ea]479#endif /* QTDIALOG_HPP_ */
Note: See TracBrowser for help on using the repository browser.