source: src/UIElements/Qt4/Query/QtQuery.hpp@ 4792ab

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 4792ab was dbf6c7, checked in by Frederik Heber <heber@…>, 12 years ago

StringQtQuery: ComboBox for discrete values

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