git-svn-id: svn://db.shs.com.ru/libs@654 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -41,6 +41,21 @@ void SpinSlider::setOrientation(Qt::Orientation orient) {
|
||||
}
|
||||
|
||||
|
||||
bool SpinSlider::adaptiveStep() const {
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
|
||||
return (spin->stepType() == QDoubleSpinBox::AdaptiveDecimalStepType);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void SpinSlider::setAdaptiveStep(bool on) {
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
|
||||
if (on) spin->setStepType(QDoubleSpinBox::AdaptiveDecimalStepType);
|
||||
else spin->setStepType(QDoubleSpinBox::DefaultStepType);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SpinSlider::adjust() {
|
||||
adjusting = true;
|
||||
delim = qPow(10, dec_);
|
||||
|
||||
@@ -19,6 +19,7 @@ class SpinSlider: public QWidget
|
||||
Q_PROPERTY(int decimals READ decimals WRITE setDecimals)
|
||||
Q_PROPERTY(double singleStep READ singleStep WRITE setSingleStep)
|
||||
Q_PROPERTY(double pageStep READ pageStep WRITE setPageStep)
|
||||
Q_PROPERTY(bool adaptiveStep READ adaptiveStep WRITE setAdaptiveStep)
|
||||
Q_PROPERTY(QString prefix READ prefix WRITE setPrefix)
|
||||
Q_PROPERTY(QString suffix READ suffix WRITE setSuffix)
|
||||
Q_PROPERTY(QSlider::TickPosition tickPosition READ tickPosition WRITE setTickPosition)
|
||||
@@ -43,6 +44,7 @@ public:
|
||||
double value() const {return val_;}
|
||||
int decimals() const {return dec_;}
|
||||
double singleStep() const {return spin->singleStep();}
|
||||
bool adaptiveStep() const;
|
||||
double pageStep() const {return page;}
|
||||
QString prefix() const {return spin->prefix();}
|
||||
QString suffix() const {return spin->suffix();}
|
||||
@@ -54,6 +56,7 @@ public:
|
||||
bool squareScale() const {return square;}
|
||||
|
||||
void setSingleStep(double step) {spin->setSingleStep(step); slider->setPageStep(qRound(step * delim));}
|
||||
void setAdaptiveStep(bool on);
|
||||
void setPageStep(double step) {page = step; slider->setPageStep(qRound(page * delim));}
|
||||
void setPrefix(QString prefix) {spin->setPrefix(prefix);}
|
||||
void setSuffix(QString suffix) {spin->setSuffix(suffix);}
|
||||
|
||||
Reference in New Issue
Block a user