Mantid
|
A QDoubleSpinBox allowing to customize numbers display with respect to. More...
#include <DoubleSpinBox.h>
Signals | |
void | activated (DoubleSpinBox *) |
Signal emitted when the spin box gains focus. More... | |
void | valueChanged (double d) |
Public Member Functions | |
void | addSpecialTextMapping (const QString &text, double value) |
Adds a mapping from string whihc may be entered into the edit box and a double value. More... | |
int | decimals () |
DoubleSpinBox (const char format='g', QWidget *parent=nullptr) | |
Constructor. More... | |
double | getMaximum () |
double | getMinimum () |
void | setDecimals (int prec) |
void | setFormat (const char format, int prec=1) |
void | setMaximum (double max) |
void | setMinimum (double min) |
void | setRange (double min, double max) |
void | setSingleStep (double val) |
bool | setValue (double val) |
QString | textFromValue (double value) const |
QValidator::State | validate (QString &input, int &pos) const override |
double | value () |
Protected Member Functions | |
void | focusInEvent (QFocusEvent *) override |
void | stepBy (int steps) override |
StepEnabled | stepEnabled () const override |
Private Slots | |
void | interpretText (bool notify=true) |
Interpret the text and update the stored value. More... | |
Private Attributes | |
char | d_format |
double | d_max_val |
double | d_min_val |
int | d_prec |
double | d_step |
double | d_value |
std::map< QString, double > | m_specialTextMappings |
A QDoubleSpinBox allowing to customize numbers display with respect to.
It allows the user to specify a custom display format.
Definition at line 31 of file DoubleSpinBox.h.
DoubleSpinBox::DoubleSpinBox | ( | const char | format = 'g' , |
QWidget * | parent = nullptr |
||
) |
Constructor.
format | format used to display numbers: has the same meaning as in QLocale::toString ( double i, char f = 'g', int prec = 6 ) |
parent | parent widget (only affects placement of the dialog) |
Definition at line 27 of file DoubleSpinBox.cpp.
References d_format, d_prec, d_value, and interpretText().
|
signal |
Signal emitted when the spin box gains focus.
Referenced by focusInEvent().
void DoubleSpinBox::addSpecialTextMapping | ( | const QString & | text, |
double | value | ||
) |
Adds a mapping from string whihc may be entered into the edit box and a double value.
The mapping is case sensitive
text | QString with text to map |
value | Value to map it to |
Definition at line 118 of file DoubleSpinBox.cpp.
References m_specialTextMappings, and value().
|
inline |
Definition at line 51 of file DoubleSpinBox.h.
|
overrideprotected |
Definition at line 170 of file DoubleSpinBox.cpp.
References activated().
double DoubleSpinBox::getMaximum | ( | ) |
Definition at line 51 of file DoubleSpinBox.cpp.
References d_max_val.
double DoubleSpinBox::getMinimum | ( | ) |
Definition at line 60 of file DoubleSpinBox.cpp.
References d_min_val.
|
privateslot |
Interpret the text and update the stored value.
notify | If true then emit signals to indicate if the value has changed (default=true) The default is important so that connected signals ensure the correct updates are pushed through but we need to be able to turn them off as there are cases where this causes a recursive call. |
Definition at line 77 of file DoubleSpinBox.cpp.
References d_value, m_specialTextMappings, setValue(), textFromValue(), value(), and valueChanged().
Referenced by DoubleSpinBox(), and value().
|
inline |
Definition at line 52 of file DoubleSpinBox.h.
|
inline |
Definition at line 60 of file DoubleSpinBox.h.
void DoubleSpinBox::setMaximum | ( | double | max | ) |
void DoubleSpinBox::setMinimum | ( | double | min | ) |
void DoubleSpinBox::setRange | ( | double | min, |
double | max | ||
) |
Definition at line 62 of file DoubleSpinBox.cpp.
References setMaximum(), and setMinimum().
void DoubleSpinBox::setSingleStep | ( | double | val | ) |
Definition at line 39 of file DoubleSpinBox.cpp.
bool DoubleSpinBox::setValue | ( | double | val | ) |
Definition at line 147 of file DoubleSpinBox.cpp.
References d_max_val, d_min_val, d_value, and textFromValue().
Referenced by interpretText(), RangeLimitBox::RangeLimitBox(), and stepBy().
|
overrideprotected |
Definition at line 120 of file DoubleSpinBox.cpp.
References d_step, d_value, fabs, setValue(), and valueChanged().
|
overrideprotected |
Definition at line 129 of file DoubleSpinBox.cpp.
QString DoubleSpinBox::textFromValue | ( | double | value | ) | const |
Definition at line 158 of file DoubleSpinBox.cpp.
References d_format, d_min_val, d_prec, and value().
Referenced by interpretText(), and setValue().
|
override |
Definition at line 168 of file DoubleSpinBox.cpp.
double DoubleSpinBox::value | ( | ) |
Definition at line 141 of file DoubleSpinBox.cpp.
References d_value, and interpretText().
Referenced by addSpecialTextMapping(), interpretText(), textFromValue(), and RangeLimitBox::value().
|
signal |
Referenced by interpretText(), and stepBy().
|
private |
Definition at line 84 of file DoubleSpinBox.h.
Referenced by DoubleSpinBox(), and textFromValue().
|
private |
Definition at line 86 of file DoubleSpinBox.h.
Referenced by getMaximum(), setMaximum(), setSingleStep(), setValue(), and stepEnabled().
|
private |
Definition at line 85 of file DoubleSpinBox.h.
Referenced by getMinimum(), setMinimum(), setValue(), stepEnabled(), and textFromValue().
|
private |
Definition at line 89 of file DoubleSpinBox.h.
Referenced by DoubleSpinBox(), and textFromValue().
|
private |
Definition at line 88 of file DoubleSpinBox.h.
Referenced by setSingleStep(), and stepBy().
|
private |
Definition at line 87 of file DoubleSpinBox.h.
Referenced by DoubleSpinBox(), interpretText(), setValue(), stepBy(), stepEnabled(), and value().
|
private |
Definition at line 93 of file DoubleSpinBox.h.
Referenced by addSpecialTextMapping(), and interpretText().