EvalSpinBox::singleStep property

This commit is contained in:
2023-04-18 14:06:21 +03:00
parent 0497a52704
commit 2f630435bb
3 changed files with 19 additions and 17 deletions

View File

@@ -19,11 +19,10 @@
EvalSpinBox::EvalSpinBox(QWidget * parent): QAbstractSpinBox(parent) {
status = new QWidget(lineEdit());
cw = new QWidget(lineEdit());
label = new QLabel(lineEdit());
eval = new QPIEvaluator();
precision_ = -1;
status = new QWidget(lineEdit());
cw = new QWidget(lineEdit());
label = new QLabel(lineEdit());
eval = new QPIEvaluator();
clear_im.load(":/icons/edit-clear-locationbar-rtl.png");
icon_ok.load(":/icons/dialog-ok-apply.png");
icon_fail.load(":/icons/dialog-warning.png");
@@ -35,8 +34,6 @@ EvalSpinBox::EvalSpinBox(QWidget * parent): QAbstractSpinBox(parent) {
cw->setCursor(Qt::ArrowCursor);
cw->setToolTip(tr("Clear"));
cw->hide();
cw_visible = false;
calc_visible = true;
cw->installEventFilter(this);
status->installEventFilter(this);
connect(lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(textChanged_(QString)));
@@ -212,7 +209,7 @@ void EvalSpinBox::setValue(double val) {
void EvalSpinBox::stepBy(int steps) {
stepByDouble(steps);
stepByDouble(steps * m_singleStep);
}
@@ -291,15 +288,16 @@ void EvalSpinBox::focusOutEvent(QFocusEvent * event) {
void EvalSpinBox::wheelEvent(QWheelEvent * event) {
if (event->modifiers().testFlag(Qt::ShiftModifier)) {
stepByDouble(
stepByDouble((
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
event->delta()
event->delta()
#else
event->angleDelta().y()
event->angleDelta().y()
#endif
> 0
? 0.1
: -0.1);
> 0
? 0.1
: -0.1) *
m_singleStep);
} else {
QAbstractSpinBox::wheelEvent(event);
}