source: src/UIElements/Qt4/Query/QtQuery.hpp@ 2fe4a5

Action_Thermostats Add_AtomRandomPerturbation Add_FitFragmentPartialChargesAction Add_RotateAroundBondAction Add_SelectAtomByNameAction Added_ParseSaveFragmentResults Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_StructOpt_integration_tests 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_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 FragmentMolecule_checks_bonddegrees GeometryObjects Gui_Fixes Gui_displays_atomic_force_velocity IndependentFragmentGrids IndependentFragmentGrids_IndividualZeroInstances IndependentFragmentGrids_IntegrationTest IndependentFragmentGrids_Sole_NN_Calculation JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks 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 2fe4a5 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
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"
[7b8a8e]19#include "QtQueryList.hpp"
[308aa4]20
[33e801]21#include "Parameters/Parameter.hpp"
22
[0275ad]23class QHBoxLayout;
[a5ddf0]24class QBoxLayout;
25class QDialogButtonBox;
26class QLabel;
27class QSpinBox;
28class QDoubleSpinBox;
29class QLineEdit;
30class QListWidget;
[0275ad]31class QPushButton;
[a5ddf0]32class QTableWidget;
[0275ad]33class QTextEdit;
[a5ddf0]34class QComboBox;
[85b112]35class QCheckBox;
[7c9921]36class QFileDialog;
[a5ddf0]37
[852ea3]38template<class T>
39class QtQuery : public Dialog::TQuery<T>
40{
41public:
[f130d4]42 QtQuery(Parameter<T> &_param, const std::string &_title, const std::string &_description = "") :
43 Dialog::TQuery<T>(_param, _title, _description) {}
[852ea3]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 *> {
[7c9921]49 Q_OBJECT
[308aa4]50public:
[f130d4]51 AtomQtQuery(Parameter<const atom *> &, const std::string &_title, const std::string &description, QBoxLayout *_parent,Dialog *_dialog);
[308aa4]52 virtual ~AtomQtQuery();
[7c9921]53
54public slots:
55 void onUpdate(int);
56
[308aa4]57private:
58 QBoxLayout *parent;
59 QBoxLayout *thisLayout;
60 QLabel *titleLabel;
61 QComboBox *inputBox;
[7dfd07]62 Dialog *dialog;
[308aa4]63};
64
[852ea3]65class QtDialog::AtomsQtQuery : public QWidget, public QtQuery<std::vector<const atom *> >, public QtQueryList<const atom *> {
[7c9921]66 Q_OBJECT
[308aa4]67public:
[f130d4]68 AtomsQtQuery(Parameter<std::vector<const atom *> > &, const std::string &_title, const std::string &description, QBoxLayout *_parent,Dialog *_dialog);
[308aa4]69 virtual ~AtomsQtQuery();
[7c9921]70
[2f4e81]71 virtual void onSubUpdate();
72
[7c9921]73public slots:
[2f4e81]74 void onAddElement();
75 void onRemoveElement();
76 void onElementSelected();
[7c9921]77
[308aa4]78private:
[2f4e81]79 AtomQtQuery *subQuery;
[308aa4]80};
81
[852ea3]82class QtDialog::BooleanQtQuery : public QWidget, public QtQuery<bool> {
[7c9921]83 Q_OBJECT
[308aa4]84public:
[f130d4]85 BooleanQtQuery(Parameter<bool> &, const std::string &_title, const std::string &description, QBoxLayout *_parent, Dialog *_dialog);
[308aa4]86 virtual ~BooleanQtQuery();
[7c9921]87
88public slots:
89 void onUpdate(int);
90
[308aa4]91private:
92 QBoxLayout *parent;
93 QBoxLayout *thisLayout;
94 QLabel *titleLabel;
[85b112]95 QCheckBox *booleanCheckBox;
[7dfd07]96 Dialog *dialog;
[308aa4]97};
98
[852ea3]99class QtDialog::RealSpaceMatrixQtQuery : public QWidget, public QtQuery<RealSpaceMatrix> {
[7c9921]100 Q_OBJECT
[308aa4]101public:
[f130d4]102 RealSpaceMatrixQtQuery(Parameter<RealSpaceMatrix> &, const std::string &_title, const std::string &description, QBoxLayout *_parent,Dialog *_dialog);
[7d9416]103 virtual ~RealSpaceMatrixQtQuery();
[7c9921]104
105public slots:
106 void onUpdate(int, int);
107
[308aa4]108private:
109 QBoxLayout *parent;
110 QBoxLayout *thisLayout;
111 QLabel *titleLabel;
112 QTableWidget *inputTable;
[7dfd07]113 Dialog *dialog;
[308aa4]114};
115
[852ea3]116class QtDialog::DoubleQtQuery : public QWidget, public QtQuery<double> {
[7c9921]117 Q_OBJECT
[308aa4]118public:
[f130d4]119 DoubleQtQuery(Parameter<double> &, const std::string &_title, const std::string &_description,QBoxLayout *_parent,Dialog *_dialog);
[308aa4]120 virtual ~DoubleQtQuery();
[7c9921]121
122public slots:
123 void onUpdate(double);
124
[308aa4]125private:
126 QBoxLayout *parent;
127 QBoxLayout *thisLayout;
128 QLabel *titleLabel;
129 QDoubleSpinBox *inputBox;
[7dfd07]130 Dialog *dialog;
[308aa4]131};
132
[852ea3]133class QtDialog::DoublesQtQuery : public QWidget, public QtQuery<std::vector<double> >, public QtQueryList<double> {
[7c9921]134 Q_OBJECT
[308aa4]135public:
[f130d4]136 DoublesQtQuery(Parameter<std::vector<double> > &, const std::string &_title, const std::string &description, QBoxLayout *_parent,Dialog *_dialog);
[308aa4]137 virtual ~DoublesQtQuery();
[7c9921]138
[7e8e79]139 virtual void onSubUpdate();
140
[7c9921]141public slots:
[7e8e79]142 void onAddElement();
143 void onRemoveElement();
144 void onElementSelected();
[7c9921]145
[308aa4]146private:
[7e8e79]147 DoubleQtQuery *subQuery;
[308aa4]148};
149
[852ea3]150class QtDialog::ElementQtQuery : public QWidget, public QtQuery<const element *> {
[7c9921]151 Q_OBJECT
[308aa4]152public:
[f130d4]153 ElementQtQuery(Parameter<const element *> &, const std::string &_title, const std::string &description, QBoxLayout *_parent, Dialog *_dialog);
[308aa4]154 virtual ~ElementQtQuery();
[7c9921]155
156public slots:
157 void onUpdate(int);
158
[308aa4]159private:
160 QBoxLayout *parent;
161 QBoxLayout *thisLayout;
162 QLabel *titleLabel;
163 QComboBox *inputBox;
[7dfd07]164 Dialog *dialog;
[308aa4]165};
166
[852ea3]167class QtDialog::ElementsQtQuery : public QWidget, public QtQuery<std::vector<const element *> >, public QtQueryList<const element *> {
[7c9921]168 Q_OBJECT
[308aa4]169public:
[f130d4]170 ElementsQtQuery(Parameter<std::vector<const element *> > &, const std::string &_title, const std::string &description, QBoxLayout *_parent,Dialog *_dialog);
[308aa4]171 virtual ~ElementsQtQuery();
[7c9921]172
[572701]173 virtual void onSubUpdate();
174
[7c9921]175public slots:
[572701]176 void onAddElement();
177 void onRemoveElement();
178 void onElementSelected();
[7c9921]179
[308aa4]180private:
[572701]181 ElementQtQuery *subQuery;
[308aa4]182};
183
184class QtDialog::EmptyQtQuery : public Dialog::EmptyQuery {
185public:
[f130d4]186 EmptyQtQuery(const std::string &_title, const std::string &description, QBoxLayout *_parent, Dialog *_dialog);
[308aa4]187 virtual ~EmptyQtQuery();
188 virtual bool handle();
189private:
190 QBoxLayout *parent;
191 QBoxLayout *thisLayout;
192 QLabel *titleLabel;
[7dfd07]193 Dialog *dialog;
[308aa4]194};
195
[852ea3]196class QtDialog::FileQtQuery : public QWidget, public QtQuery<boost::filesystem::path> {
[7c9921]197 Q_OBJECT
[308aa4]198public:
[f130d4]199 FileQtQuery(Parameter<boost::filesystem::path> &, const std::string &_title, const std::string &description, QBoxLayout *_parent, Dialog *_dialog);
[308aa4]200 virtual ~FileQtQuery();
[7c9921]201
202public slots:
203 void onUpdate();
204 void showFileDialog();
205
[308aa4]206private:
207 QBoxLayout *parent;
208 QBoxLayout *thisLayout;
209 QLabel *filenameLabel;
210 QLineEdit *filenameLineEdit;
211 QPushButton *filedialogButton;
[7c9921]212 QFileDialog *theFileDialog;
[7dfd07]213 Dialog *dialog;
[dae158]214 std::vector<std::string> suffixes;
215 bool mustBePresent;
[308aa4]216};
217
[852ea3]218class QtDialog::FilesQtQuery : public QWidget, public QtQuery<std::vector<boost::filesystem::path> >, public QtQueryList<boost::filesystem::path> {
[7c9921]219 Q_OBJECT
[2c5765]220public:
[f130d4]221 FilesQtQuery(Parameter<std::vector<boost::filesystem::path> > &, const std::string &_title, const std::string &description, QBoxLayout *_parent,Dialog *_dialog);
[2c5765]222 virtual ~FilesQtQuery();
[324403]223
224 virtual void onSubUpdate();
[7c9921]225
226public slots:
[324403]227 void onAddElement();
228 void onRemoveElement();
229 void onElementSelected();
[7c9921]230
[2c5765]231private:
[324403]232 FileQtQuery *subQuery;
[2c5765]233};
234
[852ea3]235class QtDialog::IntQtQuery : public QWidget, public QtQuery<int> {
[7c9921]236 Q_OBJECT
[308aa4]237public:
[f130d4]238 IntQtQuery(Parameter<int> &, const std::string &_title, const std::string &description,QBoxLayout *_parent,Dialog *_dialog);
[308aa4]239 virtual ~IntQtQuery();
[7c9921]240
241public slots:
242 void onUpdate(int);
243
[308aa4]244private:
245 QBoxLayout *parent;
246 QBoxLayout *thisLayout;
247 QLabel *titleLabel;
248 QSpinBox *inputBox;
[7dfd07]249 Dialog *dialog;
[308aa4]250};
251
[852ea3]252class QtDialog::IntsQtQuery : public QWidget, public QtQuery<std::vector<int> >, public QtQueryList<int> {
[7c9921]253 Q_OBJECT
[308aa4]254public:
[f130d4]255 IntsQtQuery(Parameter<std::vector<int> > &, const std::string &_title, const std::string &description, QBoxLayout *_parent,Dialog *_dialog);
[308aa4]256 virtual ~IntsQtQuery();
[26ac2d]257
258 virtual void onSubUpdate();
[7c9921]259
260public slots:
[26ac2d]261 void onAddElement();
262 void onRemoveElement();
263 void onElementSelected();
[7c9921]264
[308aa4]265private:
[26ac2d]266 IntQtQuery *subQuery;
[308aa4]267};
268
[852ea3]269class QtDialog::MoleculeQtQuery : public QWidget, public QtQuery<const molecule *> {
[7c9921]270 Q_OBJECT
[308aa4]271public:
[f130d4]272 MoleculeQtQuery(Parameter<const molecule *> &, const std::string &_title, const std::string &description, QBoxLayout *_parent,Dialog *_dialog);
[308aa4]273 virtual ~MoleculeQtQuery();
[7c9921]274
275public slots:
276 void onUpdate(int);
277
[308aa4]278private:
279 QBoxLayout *parent;
280 QBoxLayout *thisLayout;
281 QLabel *titleLabel;
282 QComboBox *inputBox;
[7dfd07]283 Dialog *dialog;
[308aa4]284};
285
[852ea3]286class QtDialog::MoleculesQtQuery : public QWidget, public QtQuery<std::vector<const molecule *> >, public QtQueryList<const molecule *> {
[7c9921]287 Q_OBJECT
[308aa4]288public:
[f130d4]289 MoleculesQtQuery(Parameter<std::vector<const molecule *> > &, const std::string &_title, const std::string &description, QBoxLayout *_parent,Dialog *_dialog);
[308aa4]290 virtual ~MoleculesQtQuery();
[7c9921]291
[1ae820]292 virtual void onSubUpdate();
293
[7c9921]294public slots:
[1ae820]295 void onAddElement();
296 void onRemoveElement();
297 void onElementSelected();
[7c9921]298
[308aa4]299private:
[1ae820]300 MoleculeQtQuery *subQuery;
[308aa4]301};
302
[33e801]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
[852ea3]339class QtDialog::StringQtQuery : public QWidget, public QtQuery<std::string> {
[7c9921]340 Q_OBJECT
[308aa4]341public:
[f130d4]342 StringQtQuery(Parameter<std::string> &, const std::string &_title, const std::string &description, QBoxLayout *_parent,Dialog *_dialog);
[308aa4]343 virtual ~StringQtQuery();
[7c9921]344
345public slots:
346 void onUpdate(const QString&);
[dbf6c7]347 void onUpdateCombo(int index);
[7c9921]348
[308aa4]349private:
350 QBoxLayout *parent;
351 QBoxLayout *thisLayout;
352 QLabel *titleLabel;
353 QLineEdit *inputBox;
[dbf6c7]354 QComboBox *comboBox;
[7dfd07]355 Dialog *dialog;
[308aa4]356};
357
[852ea3]358class QtDialog::StringsQtQuery : public QWidget, public QtQuery<std::vector<std::string> >, public QtQueryList<std::string> {
[7c9921]359 Q_OBJECT
[308aa4]360public:
[f130d4]361 StringsQtQuery(Parameter<std::vector<std::string> > &, const std::string &_title, const std::string &description, QBoxLayout *_parent,Dialog *_dialog);
[308aa4]362 virtual ~StringsQtQuery();
[7c9921]363
[7b8a8e]364 virtual void onSubUpdate();
365
[7c9921]366public slots:
[7b8a8e]367 void onAddElement();
368 void onRemoveElement();
369 void onElementSelected();
[7c9921]370
[308aa4]371private:
[7b8a8e]372 StringQtQuery *subQuery;
[308aa4]373};
374
[852ea3]375class QtDialog::UnsignedIntQtQuery : public QWidget, public QtQuery<unsigned int> {
[7c9921]376 Q_OBJECT
[838cd0]377public:
[f130d4]378 UnsignedIntQtQuery(Parameter<unsigned int> &, const std::string &_title, const std::string &description,QBoxLayout *_parent,Dialog *_dialog);
[838cd0]379 virtual ~UnsignedIntQtQuery();
[7c9921]380
381public slots:
[a2aa2f]382 void onUpdate(int);
[7c9921]383
[838cd0]384private:
385 QBoxLayout *parent;
386 QBoxLayout *thisLayout;
387 QLabel *titleLabel;
388 QSpinBox *inputBox;
[7dfd07]389 Dialog *dialog;
[838cd0]390};
391
[852ea3]392class QtDialog::UnsignedIntsQtQuery : public QWidget, public QtQuery<std::vector<unsigned int> >, public QtQueryList<unsigned int> {
[7c9921]393 Q_OBJECT
[12948c]394public:
[f130d4]395 UnsignedIntsQtQuery(Parameter<std::vector<unsigned int> > &, const std::string &_title, const std::string &description, QBoxLayout *_parent,Dialog *_dialog);
[12948c]396 virtual ~UnsignedIntsQtQuery();
[a2aa2f]397
398 virtual void onSubUpdate();
[7c9921]399
400public slots:
[a2aa2f]401 void onAddElement();
402 void onRemoveElement();
403 void onElementSelected();
[7c9921]404
[12948c]405private:
[a2aa2f]406 UnsignedIntQtQuery *subQuery;
[12948c]407};
408
[852ea3]409class QtDialog::VectorQtQuery : public QWidget, public QtQuery<Vector> {
[7c9921]410 Q_OBJECT
[308aa4]411public:
[f130d4]412 VectorQtQuery(Parameter<Vector> &, const std::string &_title, const std::string &_description,QBoxLayout *,Dialog *);
[308aa4]413 virtual ~VectorQtQuery();
[7c9921]414
415public slots:
416 void onUpdateX(double);
417 void onUpdateY(double);
418 void onUpdateZ(double);
419
[308aa4]420private:
421 QBoxLayout *parent;
422 QBoxLayout *mainLayout;
423 QLabel *titleLabel;
424 QBoxLayout *subLayout;
425 QBoxLayout *coordLayout;
426 QLabel *coordLabel;
[a14fe3]427 QDoubleSpinBox *coordInputX;
428 QDoubleSpinBox *coordInputY;
429 QDoubleSpinBox *coordInputZ;
[7dfd07]430 Dialog *dialog;
[308aa4]431};
432
[852ea3]433class QtDialog::VectorsQtQuery : public QWidget, public QtQuery<std::vector<Vector> >, public QtQueryList<Vector> {
[7c9921]434 Q_OBJECT
[308aa4]435public:
[f130d4]436 VectorsQtQuery(Parameter<std::vector<Vector> > &, const std::string &_title, const std::string &description, QBoxLayout *_parent,Dialog *_dialog);
[308aa4]437 virtual ~VectorsQtQuery();
[7c9921]438
[f84992]439 virtual void onSubUpdate();
440
[7c9921]441public slots:
[f84992]442 void onAddElement();
443 void onRemoveElement();
444 void onElementSelected();
[7c9921]445
[308aa4]446private:
[f84992]447 VectorQtQuery *subQuery;
[308aa4]448};
449
450#endif /* QTQUERY_HPP_ */
Note: See TracBrowser for help on using the repository browser.