Krita Source Code Documentation
Loading...
Searching...
No Matches
SliderSpinBox.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2010 Justin Noel <justin@ics.com>
3 * SPDX-FileCopyrightText: 2021 Deif Lou <ginoba@gmail.com>
4 *
5 * SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7
8#include "SliderSpinBox.h"
9#include "kis_debug.h"
10
16
19 , d(new Private)
20{
21 d->widget = new KisSliderSpinBox();
22
23 // Forward KisSliderSpinBox::draggingFinished to SliderSpinBox::draggingFinished
24 connect(d->widget, SIGNAL(draggingFinished()), this, SIGNAL(draggingFinished()));
25}
26
28{
29 delete d;
30}
31
32QWidget* SliderSpinBox::widget() const
33{
34 return d->widget;
35}
37{
38 return d->widget->fastSliderStep();
39}
40
42{
43 return d->widget->softMinimum();
44}
45
47{
48 return d->widget->softMaximum();
49}
50
52{
53 return d->widget->isDragging();
54}
55
56void SliderSpinBox::setValue(int newValue)
57{
58 d->widget->setValue(newValue);
59}
60
61void SliderSpinBox::setRange(int newMinimum, int newMaximum, bool computeNewFastSliderStep)
62{
63 d->widget->setRange(newMinimum, newMaximum, computeNewFastSliderStep);
64}
65
66void SliderSpinBox::setMinimum(int newMinimum, bool computeNewFastSliderStep)
67{
68 d->widget->setMinimum(newMinimum, computeNewFastSliderStep);
69}
70
71void SliderSpinBox::setMaximum(int newMaximum, bool computeNewFastSliderStep)
72{
73 d->widget->setMaximum(newMaximum, computeNewFastSliderStep);
74}
75
76void SliderSpinBox::setExponentRatio(double newExponentRatio)
77{
78 if (newExponentRatio <= 0.0) {
79 dbgScript << "Script using SliderSpinbox.setExponentRatio passed value <= 0.0 (" << newExponentRatio << "), ignoring.";
80 return;
81 }
82 d->widget->setExponentRatio(newExponentRatio);
83}
84
85void SliderSpinBox::setBlockUpdateSignalOnDrag(bool newBlockUpdateSignalOnDrag)
86{
87 d->widget->setBlockUpdateSignalOnDrag(newBlockUpdateSignalOnDrag);
88}
89
90void SliderSpinBox::setFastSliderStep(int newFastSliderStep)
91{
92 d->widget->setFastSliderStep(newFastSliderStep);
93}
94
95void SliderSpinBox::setSoftRange(int newSoftMinimum, int newSoftMaximum)
96{
97 d->widget->setSoftRange(newSoftMinimum, newSoftMaximum);
98}
99
100void SliderSpinBox::setSoftMinimum(int newSoftMinimum)
101{
102 d->widget->setSoftMinimum(newSoftMinimum);
103}
104
105void SliderSpinBox::setSoftMaximum(int newSoftMaximum)
106{
107 d->widget->setSoftMaximum(newSoftMaximum);
108}
109
115
118 , d(new Private)
119{
121
122 // Forward KisDoubleSliderSpinBox::draggingFinished to DoubleSliderSpinBox::draggingFinished
123 connect(d->widget, SIGNAL(draggingFinished()), this, SIGNAL(draggingFinished()));
124}
125
130
132{
133 return d->widget;
134}
135
137{
138 return d->widget->fastSliderStep();
139}
140
142{
143 return d->widget->softMinimum();
144}
145
147{
148 return d->widget->softMaximum();
149}
150
152{
153 return d->widget->isDragging();
154}
155
156void DoubleSliderSpinBox::setValue(double newValue)
157{
158 d->widget->setValue(newValue);
159}
160
161void DoubleSliderSpinBox::setRange(double newMinimum, double newMaximum, int newNumberOfDecimals, bool computeNewFastSliderStep)
162{
163 d->widget->setRange(newMinimum, newMaximum, newNumberOfDecimals, computeNewFastSliderStep);
164}
165
166void DoubleSliderSpinBox::setMinimum(double newMinimum, bool computeNewFastSliderStep)
167{
168 d->widget->setMinimum(newMinimum, computeNewFastSliderStep);
169}
170
171void DoubleSliderSpinBox::setMaximum(double newMaximum, bool computeNewFastSliderStep)
172{
173 d->widget->setMaximum(newMaximum, computeNewFastSliderStep);
174}
175
176void DoubleSliderSpinBox::setExponentRatio(double newExponentRatio)
177{
178 if (newExponentRatio <= 0.0) {
179 dbgScript << "Script using DoubleSliderSpinbox.setExponentRatio passed value <= 0.0 (" << newExponentRatio << "), ignoring.";
180 return;
181 }
182 d->widget->setExponentRatio(newExponentRatio);
183}
184
185void DoubleSliderSpinBox::setBlockUpdateSignalOnDrag(bool newBlockUpdateSignalOnDrag)
186{
187 d->widget->setBlockUpdateSignalOnDrag(newBlockUpdateSignalOnDrag);
188}
189
190void DoubleSliderSpinBox::setFastSliderStep(double newFastSliderStep)
191{
192 d->widget->setFastSliderStep(newFastSliderStep);
193}
194
195void DoubleSliderSpinBox::setSoftRange(double newSoftMinimum, double newSoftMaximum)
196{
197 d->widget->setSoftRange(newSoftMinimum, newSoftMaximum);
198}
199
200void DoubleSliderSpinBox::setSoftMinimum(double newSoftMinimum)
201{
202 setSoftRange(newSoftMinimum, d->widget->softMaximum());
203}
204
205void DoubleSliderSpinBox::setSoftMaximum(double newSoftMaximum)
206{
207 setSoftRange(d->widget->softMinimum(), newSoftMaximum);
208}
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
A wrapper around KisDoubleParseSpinBox, which is a cleverer doubleSpinBox, able to parse arithmetic e...
void setRange(qreal newMinimum, qreal newMaximum, int newNumberOfDecimals=0, bool computeNewFastSliderStep=true)
Set the minimum and the maximum values of the range.
qreal softMinimum() const
~DoubleSliderSpinBox() override
void setSoftMaximum(qreal newSoftMaximum)
void setMinimum(qreal newMinimum, bool computeNewFastSliderStep=true)
void setValue(qreal newValue)
qreal fastSliderStep() const
void setFastSliderStep(qreal newFastSliderStep)
void setMaximum(qreal newMaximum, bool computeNewFastSliderStep=true)
void setBlockUpdateSignalOnDrag(bool newBlockUpdateSignalOnDrag)
void setSoftMinimum(qreal newSoftMinimum)
qreal softMaximum() const
QWidget * widget() const
Get the internal KisDoubleSliderSpinBox as a QWidget, so it may be added to a UI.
void setSoftRange(qreal newSoftMinimum, qreal newSoftMaximum)
void setExponentRatio(qreal newExponentRatio)
A wrapper around KisIntParseSpinBox, which is a cleverer SpinBox, able to parse arithmetic expression...
This class is a spinbox in which you can click and drag to set the value. A slider like bar is displa...
void setMaximum(qreal newMaximum, bool computeNewFastSliderStep=true)
void setValue(qreal newValue)
void setRange(qreal newMinimum, qreal newMaximum, int newNumberOfDecimals=0, bool computeNewFastSliderStep=true)
Set the minimum and the maximum values of the range.
void setBlockUpdateSignalOnDrag(bool newBlockUpdateSignalOnDrag)
void setExponentRatio(qreal newExponentRatio)
void setSoftRange(qreal newSoftMinimum, qreal newSoftMaximum)
void setFastSliderStep(qreal newFastSliderStep)
void setMinimum(qreal newMinimum, bool computeNewFastSliderStep=true)
This class is a spinbox in which you can click and drag to set the value. A slider like bar is displa...
int fastSliderStep() const
Get the value to which multiples the sinbox value snaps when the control key is pressed.
void setBlockUpdateSignalOnDrag(bool newBlockUpdateSignalOnDrag)
Set if the spinbox should not Q_EMIT signals when dragging the slider.
void setExponentRatio(qreal newExponentRatio)
Set the exponent used by a power function to modify the values as a function of the horizontal positi...
void setMinimum(int newMinimum, bool computeNewFastSliderStep=true)
Set the minimum value of the range.
void setSoftMinimum(int newSoftMinimum)
Set the minimum value of the soft range.
void setSoftRange(int newSoftMinimum, int newSoftMaximum)
Set the minimum and the maximum values of the soft range.
void setFastSliderStep(int newFastSliderStep)
Set the value to which multiples the sinbox value snaps when the control key is pressed.
int softMaximum() const
Get the maximum value of the "soft range".
void setValue(int newValue)
void setSoftMaximum(int newSoftMaximum)
Set the maximum value of the soft range.
void setMaximum(int newMaximum, bool computeNewFastSliderStep=true)
Set the maximum value of the range.
bool isDragging() const
Get if the user is currently dragging the slider with the pointer.
void setRange(int newMinimum, int newMaximum, bool computeNewFastSliderStep=true)
Set the minimum and the maximum values of the range, computing a new "fast slider step" based on the ...
int softMinimum() const
Get the minimum value of the "soft range".
void setMinimum(int newMinimum, bool computeNewFastSliderStep=true)
Set the minimum value of the range.
int fastSliderStep() const
Get the value to which multiples the spinbox value snaps when the control key is pressed.
void draggingFinished()
void setFastSliderStep(int newFastSliderStep)
Set the value to which multiples the spinbox value snaps when the control key is pressed.
Private *const d
void setRange(int newMinimum, int newMaximum, bool computeNewFastSliderStep=true)
Set the minimum and the maximum values of the range, computing a new "fast slider step" based on the ...
int softMinimum() const
Get the minimum value of the "soft range".
void setValue(int newValue)
Set the value.
int softMaximum() const
Get the maximum value of the "soft range".
void setSoftRange(int newSoftMinimum, int newSoftMaximum)
Set the minimum and the maximum values of the soft range.
void setBlockUpdateSignalOnDrag(bool newBlockUpdateSignalOnDrag)
Set if the spinbox should not Q_EMIT signals when dragging the slider.
void setSoftMaximum(int newSoftMaximum)
Set the maximum value of the soft range.
QWidget * widget() const
Get the internal KisSliderSpinBox as a QWidget, so it may be added to a UI.
void setExponentRatio(qreal newExponentRatio)
Set the exponent used by a power function to modify the values as a function of the horizontal positi...
~SliderSpinBox() override
void setMaximum(int newMaximum, bool computeNewFastSliderStep=true)
Set the maximum value of the range.
bool isDragging() const
Get if the user is currently dragging the slider with the pointer.
void setSoftMinimum(int newSoftMinimum)
Set the minimum value of the soft range.
#define dbgScript
Definition kis_debug.h:56