Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_int_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 QSpinBox(parent),
15 d(new KisParseSpinBoxPrivate<KisIntParseSpinBox, QSpinBox>(this))
16{}
17
20
22{
23 d->stepBy(steps);
24}
25
26void KisIntParseSpinBox::setValue(int 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 KisIntParseSpinBox::validate(QString &input, int &pos) const
42{
43 return d->validate(input, pos);
44}
45
46int KisIntParseSpinBox::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 KisIntParseSpinBox class is a cleverer SpinBox, able to parse arithmetic expressions.
int valueFromText(const QString &text) const override
virtual QString veryCleanText() const
This virtual function is similar to cleanText(). But child classes may reimplement it to further proc...
bool isLastValid() const
Get if the last expression entered is a valid one.
QScopedPointer< KisParseSpinBoxPrivate< KisIntParseSpinBox, QSpinBox > > d
void setValue(int value, bool overwriteExpression=false)
Set the value of the spinbox.
QValidator::State validate(QString &input, int &pos) const override
void stepBy(int steps) override
This is a reimplementation of QSpinBox::stepBy that uses setValue.
QString textFromValue(int value) const override
KisIntParseSpinBox(QWidget *parent=0)