Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_double_parse_spin_box.cpp
Go to the documentation of this file.
1/* This file is part of the KDE project
2 *
3 * SPDX-FileCopyrightText: 2016 Laurent Valentin Jospin <laurent.valentin@famillejospin.ch>
4 * SPDX-FileCopyrightText: 2021 Deif Lou <ginoba@gmail.com>
5 *
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
8
10
12
14 QDoubleSpinBox(parent),
15 d(new KisParseSpinBoxPrivate<KisDoubleParseSpinBox, QDoubleSpinBox>(this))
16{}
17
20
22{
23 d->stepBy(steps);
24}
25
26void KisDoubleParseSpinBox::setValue(double value, bool overwriteExpression)
27{
28 d->setValue(value, overwriteExpression);
29}
30
32{
33 return d->isLastValid();
34}
35
37{
38 return d->veryCleanText();
39}
40
41QValidator::State KisDoubleParseSpinBox::validate(QString &input, int &pos) const
42{
43 return d->validate(input, pos);
44}
45
46double KisDoubleParseSpinBox::valueFromText(const QString &text) const
47{
48 return d->valueFromText(text);
49}
50
52{
53 return d->textFromValue(value);
54}
float value(const T *src, size_t ch)
The KisDoubleParseSpinBox class is a cleverer doubleSpinBox, able to parse arithmetic expressions.
QValidator::State validate(QString &input, int &pos) const override
KisDoubleParseSpinBox(QWidget *parent=0)
bool isLastValid() const
Get if the last expression entered is a valid one.
void setValue(double value, bool overwriteExpression=false)
Set the value of the spinbox.
QString textFromValue(double value) const override
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 proc...
QScopedPointer< KisParseSpinBoxPrivate< KisDoubleParseSpinBox, QDoubleSpinBox > > d
double valueFromText(const QString &text) const override