using QskBoundedValueInput as base class
This commit is contained in:
parent
04fa1c6dd6
commit
890ae64652
|
@ -45,19 +45,6 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
void setValue(qreal value)
|
||||
{
|
||||
value = qBound(q->minimum(), value, q->maximum());
|
||||
if(!qFuzzyCompare(m_value, value))
|
||||
{
|
||||
m_value = value;
|
||||
Q_EMIT q->valueChanged(m_value);
|
||||
q->update();
|
||||
}
|
||||
}
|
||||
|
||||
qreal value() const { return m_value; }
|
||||
|
||||
FocusIndeces defaultFocusIndex() const
|
||||
{
|
||||
const auto layout = q->alignmentHint(QskSpinBox::Layout);
|
||||
|
@ -170,7 +157,6 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
qreal m_value{0.0f};
|
||||
QskSpinBox* const q;
|
||||
FocusIndeces m_focusIndex = FocusIndeces::None;
|
||||
};
|
||||
|
@ -187,8 +173,6 @@ QskSpinBox::QskSpinBox(QQuickItem* const parent)
|
|||
setFocusPolicy( Qt::StrongFocus );
|
||||
|
||||
connect( this, &S::focusIndexChanged, this, &S::focusIndicatorRectChanged );
|
||||
connect( this, &S::boundariesChanged, this, [this](const QskIntervalF& interval){ if(!interval.contains(value())) m_data->setValue(minimum()); });
|
||||
connect( this, &S::valueChanged, this, [this](){ polish(); });
|
||||
}
|
||||
|
||||
QskSpinBox::~QskSpinBox() = default;
|
||||
|
@ -364,16 +348,6 @@ QRectF QskSpinBox::focusIndicatorRect() const
|
|||
return rect;
|
||||
}
|
||||
|
||||
void QskSpinBox::increment(qreal offset)
|
||||
{
|
||||
m_data->setValue(m_data->value() + offset);
|
||||
}
|
||||
|
||||
qreal QskSpinBox::value() const
|
||||
{
|
||||
return m_data->value();
|
||||
}
|
||||
|
||||
QskSpinBox::FocusIndeces QskSpinBox::focusIndex() const
|
||||
{
|
||||
return m_data->focusIndex();
|
||||
|
|
|
@ -7,31 +7,25 @@
|
|||
|
||||
#include <QskControl.h>
|
||||
#include <QskPushButton.h>
|
||||
#include <QskBoundedInput.h>
|
||||
#include <QskBoundedValueInput.h>
|
||||
|
||||
class QSK_EXPORT QskSpinBox : public QskBoundedInput
|
||||
class QSK_EXPORT QskSpinBox : public QskBoundedValueInput
|
||||
{
|
||||
Q_OBJECT
|
||||
using Inherited = QskBoundedInput;
|
||||
using Inherited = QskBoundedValueInput;
|
||||
public:
|
||||
enum FocusIndeces : int { Decrement = 0, Textbox = 1, Increment = 2, None = 3 };
|
||||
Q_ENUM(FocusIndeces)
|
||||
|
||||
Q_PROPERTY(qreal value READ value NOTIFY valueChanged)
|
||||
Q_PROPERTY(FocusIndeces focusIndex READ focusIndex NOTIFY focusIndexChanged)
|
||||
QSK_SUBCONTROLS(IncrementPanel, DecrementPanel, IncrementText, DecrementText, TextPanel, Text, Layout)
|
||||
QSK_STATES( Pressed )
|
||||
|
||||
explicit QskSpinBox( QQuickItem* parent = nullptr );
|
||||
~QskSpinBox() override;
|
||||
|
||||
void increment( qreal offset ) override;
|
||||
qreal value() const;
|
||||
|
||||
FocusIndeces focusIndex() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void valueChanged(qreal value);
|
||||
void focusIndexChanged(int index);
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in New Issue