10#include <QDoubleSpinBox>
25 template <
class Sl
ider>
27 :
m_slider(QVariant::fromValue(slider)),
33 slider->changeValuePt(
value);
36 slider->setValue(
value);
39 slider->setValue(
value);
41 }
else if (
auto *slider =
m_slider.value<QDoubleSpinBox*>()) {
42 slider->setValue(
value);
45 slider->setValue(qRound(
value));
48 slider->setValue(qRound(
value));
50 }
else if (
auto *slider =
m_slider.value<QSpinBox*>()) {
51 slider->setValue(qRound(
value));
54 slider->setAngle(
value);
57 slider->setAngle(
value);
65 result = slider->valuePt();
67 result = slider->value();
70 result = slider->value();
72 }
else if (
auto *slider =
m_slider.value<QDoubleSpinBox*>()) {
73 result = slider->value();
76 result = slider->value();
79 result = slider->value();
81 }
else if (
auto *slider =
m_slider.value<QSpinBox*>()) {
82 result = slider->value();
85 result = slider->angle();
88 result = slider->angle();
99 result = slider->isDragging();
102 result = slider->isDragging();
111 QObject::connect(slider, SIGNAL(draggingFinished()),
115 QObject::connect(slider, SIGNAL(draggingFinished()),
150template <
class SpinBoxType>
155 m_d->aspectButton = aspectButton;
157 if (QVariant::fromValue(spinOne->value()).type() == QVariant::Double) {
172template <
class AngleBoxType>
177 m_d->aspectButton = aspectButton;
199 if (
m_d->aspectButton->keepAspectRatio()) {
201 m_d->spinTwo->setValue(
m_d->aspectRatio *
m_d->spinOne->value());
204 if (!
m_d->blockUpdatesOnDrag || !
m_d->spinOne->isDragging()) {
211 if (
m_d->aspectButton->keepAspectRatio()) {
213 m_d->spinOne->setValue(
m_d->spinTwo->value() /
m_d->aspectRatio);
216 if (!
m_d->blockUpdatesOnDrag || !
m_d->spinTwo->isDragging()) {
223 if (
m_d->aspectButton->keepAspectRatio() &&
224 m_d->spinTwo->value() > 0 &&
225 m_d->spinOne->value() > 0) {
226 m_d->aspectRatio = qreal(
m_d->spinTwo->value()) /
m_d->spinOne->value();
228 m_d->aspectRatio = 1.0;
231 if (!
m_d->spinTwo->isDragging()) {
239 if (
m_d->blockUpdatesOnDrag) {
float value(const T *src, size_t ch)
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
A circular widget that allows to choose an angle.
A widget with several options to select an angle.
void connectSpinBoxes(SpinBoxType *spinOne, SpinBoxType *spinTwo, KoAspectButton *aspectButton)
void slotSpinOneChanged()
void slotSpinTwoChanged()
const QScopedPointer< Private > m_d
void connectAngleBoxes(AngleBoxType *spinOne, AngleBoxType *spinTwo, KoAspectButton *aspectButton)
void sliderValueChanged()
KisAspectRatioLocker(QObject *parent=0)
void aspectButtonToggled(bool value)
void aspectButtonChanged()
void setBlockUpdateSignalOnDrag(bool block)
~KisAspectRatioLocker() override
void slotSpinDraggingFinished()
void slotAspectButtonChanged()
The KisDoubleParseSpinBox class is a cleverer doubleSpinBox, able to parse arithmetic expressions.
The KisDoubleParseUnitSpinBox class is an evolution of the.
This class is a spinbox in which you can click and drag to set the value. A slider like bar is displa...
The KisIntParseSpinBox class is a cleverer SpinBox, able to parse arithmetic expressions.
This class is a spinbox in which you can click and drag to set the value. A slider like bar is displa...
KoAspectButton * aspectButton
QScopedPointer< SliderWrapper > spinTwo
QScopedPointer< SliderWrapper > spinOne
void connectDraggingFinished(QObject *receiver, const char *amember)
void setValue(qreal value)
SliderWrapper(Slider *slider)