Krita Source Code Documentation
Loading...
Searching...
No Matches
KisSelectionPropertySliderBase Class Referenceabstract

#include <KisSelectionPropertySlider.h>

+ Inheritance diagram for KisSelectionPropertySliderBase:

Classes

struct  Private
 

Public Member Functions

 KisSelectionPropertySliderBase (QWidget *parent=0)
 
void setPrefix (const QString &)=delete
 
void setSuffix (const QString &)=delete
 
void setTextTemplates (const QString &normalTemplate, const QString &mixedTemplate)
 
 ~KisSelectionPropertySliderBase () override
 
- Public Member Functions inherited from KisDoubleSliderSpinBox
qreal fastSliderStep () const
 
bool isDragging () const
 
 KisDoubleSliderSpinBox (QWidget *parent=nullptr)
 
QSize minimumSizeHint () const override
 
void setBlockUpdateSignalOnDrag (bool newBlockUpdateSignalOnDrag)
 
void setExponentRatio (qreal newExponentRatio)
 
void setFastSliderStep (qreal newFastSliderStep)
 
void setMaximum (qreal newMaximum, bool computeNewFastSliderStep=true)
 
void setMinimum (qreal newMinimum, bool computeNewFastSliderStep=true)
 
void setRange (qreal newMinimum, qreal newMaximum, int newNumberOfDecimals=0, bool computeNewFastSliderStep=true)
 Set the minimum and the maximum values of the range.
 
void setSoftMaximum (qreal newSoftMaximum)
 
void setSoftMinimum (qreal newSoftMinimum)
 
void setSoftRange (qreal newSoftMinimum, qreal newSoftMaximum)
 
void setValue (qreal newValue)
 
QSize sizeHint () const override
 
qreal softMaximum () const
 
qreal softMinimum () const
 
 ~KisDoubleSliderSpinBox () override
 
- Public Member Functions inherited from KisDoubleParseSpinBox
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
 

Protected Member Functions

virtual qreal getCommonValue () const =0
 
virtual bool hasSelection () const =0
 
void setInternalValue (qreal value, bool blockUpdateSignal) override
 
void setSelectionValue (qreal commonValue, bool mixed)
 
- Protected Member Functions inherited from KisDoubleSliderSpinBox
void setPrivateValue (qreal newValue)
 
- Protected Member Functions inherited from KisDoubleParseSpinBox
QString textFromValue (double value) const override
 
QValidator::State validate (QString &input, int &pos) const override
 
double valueFromText (const QString &text) const override
 

Private Slots

void slotCompressedUpdate ()
 

Private Attributes

const QScopedPointer< Privatem_d
 

Additional Inherited Members

- Signals inherited from KisDoubleSliderSpinBox
void draggingFinished ()
 
- Signals inherited from KisDoubleParseSpinBox
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.
 

Detailed Description

Definition at line 17 of file KisSelectionPropertySlider.h.

Constructor & Destructor Documentation

◆ KisSelectionPropertySliderBase()

KisSelectionPropertySliderBase::KisSelectionPropertySliderBase ( QWidget * parent = 0)
explicit

Definition at line 25 of file KisSelectionPropertySlider.cpp.

27 , m_d(new Private(this))
28{
29 connect(m_d->signalCompressor, SIGNAL(timeout()), SLOT(slotCompressedUpdate()));
30}
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
KisDoubleSliderSpinBox(QWidget *parent=nullptr)
const QScopedPointer< Private > m_d

References connect(), m_d, and slotCompressedUpdate().

◆ ~KisSelectionPropertySliderBase()

KisSelectionPropertySliderBase::~KisSelectionPropertySliderBase ( )
override

Definition at line 32 of file KisSelectionPropertySlider.cpp.

33{}

Member Function Documentation

◆ getCommonValue()

virtual qreal KisSelectionPropertySliderBase::getCommonValue ( ) const
protectedpure virtual

◆ hasSelection()

virtual bool KisSelectionPropertySliderBase::hasSelection ( ) const
protectedpure virtual

◆ setInternalValue()

void KisSelectionPropertySliderBase::setInternalValue ( qreal value,
bool blockUpdateSignal )
overrideprotectedvirtual

Reimplemented from KisDoubleSliderSpinBox.

Definition at line 42 of file KisSelectionPropertySlider.cpp.

43{
44 static const qreal eps = 1e-3;
45
46 if (!hasSelection()) return;
47
48 setPrivateValue(_value);
49
50 const qreal newValue = value();
51 const qreal commonValue = getCommonValue();
52 if (qAbs(commonValue - newValue) < eps) {
53 return;
54 }
55
56 if(!blockUpdateSignal) {
57 m_d->signalCompressor->start();
58 }
59}
float value(const T *src, size_t ch)
void setPrivateValue(qreal newValue)
virtual bool hasSelection() const =0
virtual qreal getCommonValue() const =0
const qreal eps

References eps, getCommonValue(), hasSelection(), m_d, KisDoubleSliderSpinBox::setPrivateValue(), and value().

◆ setPrefix()

void KisSelectionPropertySliderBase::setPrefix ( const QString & )
delete

Deleted function - use setTextTemplates instead.

◆ setSelectionValue()

void KisSelectionPropertySliderBase::setSelectionValue ( qreal commonValue,
bool mixed )
protected

Definition at line 66 of file KisSelectionPropertySlider.cpp.

67{
68 if (mixed) {
69 setInternalValue(0.0, true); // BUG:409131
70 KisSpinBoxI18nHelper::setText(static_cast<QDoubleSpinBox *>(this), m_d->mixedTemplate);
71 } else {
72 setValue(commonValue);
73 KisSpinBoxI18nHelper::setText(static_cast<QDoubleSpinBox *>(this), m_d->normalTemplate);
74 }
75}
void setValue(qreal newValue)
void setInternalValue(qreal value, bool blockUpdateSignal) override
void setText(QSpinBox *spinBox, const QStringView textTemplate)

References m_d, setInternalValue(), KisSpinBoxI18nHelper::setText(), and KisDoubleSliderSpinBox::setValue().

◆ setSuffix()

void KisSelectionPropertySliderBase::setSuffix ( const QString & )
delete

Deleted function - use setTextTemplates instead.

◆ setTextTemplates()

void KisSelectionPropertySliderBase::setTextTemplates ( const QString & normalTemplate,
const QString & mixedTemplate )

Set the prefix/suffix using i18n strings in the form of prefix {n} suffix.

Parameters
normalTemplateThe text in the form of prefix{n}suffix, usually passed through i18n or i18nc, for when there is only one selection or multiple selections with the same value.
mixedTemplateThe text in the form of prefix{n}suffix, usually passed through i18n or i18nc, for when there are multiple selections with different values.

Definition at line 35 of file KisSelectionPropertySlider.cpp.

36{
37 m_d->normalTemplate = normalTemplate;
38 m_d->mixedTemplate = mixedTemplate;
39 KisSpinBoxI18nHelper::setText(static_cast<QDoubleSpinBox *>(this), normalTemplate);
40}

References m_d, and KisSpinBoxI18nHelper::setText().

◆ slotCompressedUpdate

void KisSelectionPropertySliderBase::slotCompressedUpdate ( )
privateslot

Definition at line 61 of file KisSelectionPropertySlider.cpp.

62{
63 emit(valueChanged(value()));
64}

References value().

Member Data Documentation

◆ m_d

const QScopedPointer<Private> KisSelectionPropertySliderBase::m_d
private

Definition at line 61 of file KisSelectionPropertySlider.h.


The documentation for this class was generated from the following files: