The KisDoubleParseSpinBox class is a cleverer doubleSpinBox, able to parse arithmetic expressions.
More...
#include <kis_double_parse_spin_box.h>
|
| void | errorWhileParsing (const QString &expr) const |
| | signal emitted when the last parsed expression is not valid.
|
| |
| void | noMoreParsingError () const |
| | signal emitted when the last parsed expression is valid and the expression before was not valid.
|
| |
|
| bool | isLastValid () const |
| | Get if the last expression entered is a valid one.
|
| |
| | KisDoubleParseSpinBox (QWidget *parent=0) |
| |
| void | setValue (double value, bool overwriteExpression=false) |
| | Set the value of the spinbox.
|
| |
| void | stepBy (int steps) override |
| | This is a reimplementation of QDoubleSpinBox::stepBy that uses setValue.
|
| |
| virtual QString | veryCleanText () const |
| | This virtual function is similar to cleanText(). But child classes may reimplement it to further process ("clean up") the expression.
|
| |
| | ~KisDoubleParseSpinBox () override |
| |
The KisDoubleParseSpinBox class is a cleverer doubleSpinBox, able to parse arithmetic expressions.
Use this spinbox instead of the basic one from Qt if you want it to be able to parse arithmetic expressions.
Definition at line 25 of file kis_double_parse_spin_box.h.
◆ KisDoubleParseSpinBox()
| KisDoubleParseSpinBox::KisDoubleParseSpinBox |
( |
QWidget * | parent = 0 | ) |
|
Definition at line 13 of file kis_double_parse_spin_box.cpp.
13 :
14 QDoubleSpinBox(parent),
16{}
QScopedPointer< KisParseSpinBoxPrivate< KisDoubleParseSpinBox, QDoubleSpinBox > > d
◆ ~KisDoubleParseSpinBox()
| KisDoubleParseSpinBox::~KisDoubleParseSpinBox |
( |
| ) |
|
|
override |
◆ errorWhileParsing
| void KisDoubleParseSpinBox::errorWhileParsing |
( |
const QString & | expr | ) |
const |
|
signal |
signal emitted when the last parsed expression is not valid.
◆ isLastValid()
| bool KisDoubleParseSpinBox::isLastValid |
( |
| ) |
const |
Get if the last expression entered is a valid one.
- Return values
-
| true | if the last expression entered is valid |
| false | otherwise |
Definition at line 31 of file kis_double_parse_spin_box.cpp.
32{
33 return d->isLastValid();
34}
References d.
◆ noMoreParsingError
| void KisDoubleParseSpinBox::noMoreParsingError |
( |
| ) |
const |
|
signal |
signal emitted when the last parsed expression is valid and the expression before was not valid.
◆ setValue()
| void KisDoubleParseSpinBox::setValue |
( |
double | value, |
|
|
bool | overwriteExpression = false ) |
Set the value of the spinbox.
This reimplementation also tries to clear the current expression and warning message whenever possible. This will happen when the new value is different from the current one and the line edit has not the focus or it is read-only. One can force the reset also by passing true to the overwriteExpression parameter.
- Parameters
-
| value | The new value |
| overwriteExpression | Get if the expression in the edit field (and the warning message) should be reset to reflect the new value. The default is false so that if the user is editing the expression it won't be disrupted by any default call to this function |
Definition at line 26 of file kis_double_parse_spin_box.cpp.
27{
28 d->setValue(
value, overwriteExpression);
29}
float value(const T *src, size_t ch)
References d, and value().
◆ stepBy()
| void KisDoubleParseSpinBox::stepBy |
( |
int | steps | ) |
|
|
override |
This is a reimplementation of QDoubleSpinBox::stepBy that uses setValue.
- Parameters
-
| steps | Number of steps that the value should change |
Definition at line 21 of file kis_double_parse_spin_box.cpp.
References d.
◆ textFromValue()
| QString KisDoubleParseSpinBox::textFromValue |
( |
double | value | ) |
const |
|
overrideprotected |
◆ validate()
| QValidator::State KisDoubleParseSpinBox::validate |
( |
QString & | input, |
|
|
int & | pos ) const |
|
overrideprotected |
◆ valueFromText()
| double KisDoubleParseSpinBox::valueFromText |
( |
const QString & | text | ) |
const |
|
overrideprotected |
◆ veryCleanText()
| QString KisDoubleParseSpinBox::veryCleanText |
( |
| ) |
const |
|
virtual |
This virtual function is similar to cleanText(). But child classes may reimplement it to further process ("clean up") the expression.
- Returns
- The processed expression
Reimplemented in KisDoubleParseUnitSpinBox.
Definition at line 36 of file kis_double_parse_spin_box.cpp.
37{
38 return d->veryCleanText();
39}
References d.
◆ KisParseSpinBoxPrivate
template<typename SpinBoxTypeTP , typename BaseSpinBoxTypeTP >
The documentation for this class was generated from the following files: