BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
DoubleLineEdit.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/View/Common/DoubleLineEdit.h
6 //! @brief Defines class DoubleLineEdit
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2021
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_GUI_VIEW_COMMON_DOUBLELINEEDIT_H
16 #define BORNAGAIN_GUI_VIEW_COMMON_DOUBLELINEEDIT_H
17 
19 #include <QLineEdit>
20 
21 class QDoubleValidator;
22 
23 //! LineEdit to edit values in a scientific notation, operating on a DoubleDescriptor.
24 //!
25 //! In the future it can be enhanced to support units. At the moment, no DoubleDescriptor with units
26 //! is used with a DoubleLineEdit, therefore the handling of units is not implemented yet. Only the
27 //! naming is prepared already (also to have a naming alike to DoubleSpinBox).
28 class DoubleLineEdit : public QLineEdit {
29  Q_OBJECT
30 public:
31  DoubleLineEdit(QWidget* parent, const DoubleDescriptor& d);
32 
33  //! Set the base value (unit is the one of the contained descriptor).
34  void setBaseValue(double baseValue);
35 
36  //! The descriptor on which this line edit operates.
37  const DoubleDescriptor& valueDescriptor() const;
38 
39 signals:
40  //! Emitted whenever the value changes.
41  //!
42  //! newBaseValue is in the unit of the valueDescriptor.
43  void baseValueChanged(double newBaseValue);
44 
45 private slots:
46  void onEditingFinished();
47 
48 private:
49  QDoubleValidator* m_validator;
51 };
52 
53 
54 #endif // BORNAGAIN_GUI_VIEW_COMMON_DOUBLELINEEDIT_H
Defines class DoubleDescriptor.
Describes properties of a double value which are necessary to allow GUI representation,...
LineEdit to edit values in a scientific notation, operating on a DoubleDescriptor.
const DoubleDescriptor & valueDescriptor() const
The descriptor on which this line edit operates.
void baseValueChanged(double newBaseValue)
Emitted whenever the value changes.
DoubleLineEdit(QWidget *parent, const DoubleDescriptor &d)
void setBaseValue(double baseValue)
Set the base value (unit is the one of the contained descriptor).
QDoubleValidator * m_validator
void onEditingFinished()
DoubleDescriptor m_valueDescriptor