diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/styles/qcommonstyle.cpp | 3 | ||||
-rw-r--r-- | src/widgets/styles/qstyle.cpp | 7 | ||||
-rw-r--r-- | src/widgets/styles/qstyle.h | 1 | ||||
-rw-r--r-- | src/widgets/widgets/qabstractspinbox.cpp | 5 |
4 files changed, 16 insertions, 0 deletions
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 4c01807ca7..544cc5ef95 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -5306,6 +5306,9 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget case SH_SpinBox_ButtonsInsideFrame: ret = true; break; + case SH_SpinBox_StepModifier: + ret = Qt::ControlModifier; + break; default: ret = 0; break; diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp index 73a6554f1a..8006be8c27 100644 --- a/src/widgets/styles/qstyle.cpp +++ b/src/widgets/styles/qstyle.cpp @@ -2001,6 +2001,13 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, Determnines if the spin box buttons are inside the line edit frame. This enum value has been introduced in Qt 5.11. + \value SH_SpinBox_StepModifier + Determines which Qt::KeyboardModifier increases the step rate of + QAbstractSpinBox. Possible values are Qt::NoModifier, + Qt::ControlModifier (default) or Qt::ShiftModifier. Qt::NoModifier + disables this feature. + This enum value has been introduced in Qt 5.12. + \sa styleHint() */ diff --git a/src/widgets/styles/qstyle.h b/src/widgets/styles/qstyle.h index cef569d514..9192dae864 100644 --- a/src/widgets/styles/qstyle.h +++ b/src/widgets/styles/qstyle.h @@ -741,6 +741,7 @@ public: SH_Widget_Animation_Duration, SH_ComboBox_AllowWheelScrolling, SH_SpinBox_ButtonsInsideFrame, + SH_SpinBox_StepModifier, // Add new style hint values here SH_CustomBase = 0xf0000000 diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp index 0459eadfff..822d896ee6 100644 --- a/src/widgets/widgets/qabstractspinbox.cpp +++ b/src/widgets/widgets/qabstractspinbox.cpp @@ -106,6 +106,10 @@ QT_BEGIN_NAMESPACE the spinbox buttons. Note that on macOS, Control corresponds to the Command key. + Since Qt 5.12, QStyle::SH_SpinBox_StepModifier can be used to select + which Qt::KeyboardModifier increases the step rate. Qt::NoModifier + disables this feature. + QAbstractSpinBox also provide a virtual function stepEnabled() to determine whether stepping up/down is allowed at any point. This function returns a bitset of StepEnabled. @@ -840,6 +844,7 @@ void QAbstractSpinBox::changeEvent(QEvent *event) style()->styleHint(QStyle::SH_SpinBox_ClickAutoRepeatThreshold, 0, this); if (d->edit) d->edit->setFrame(!style()->styleHint(QStyle::SH_SpinBox_ButtonsInsideFrame, nullptr, this)); + d->stepModifier = static_cast<Qt::KeyboardModifier>(style()->styleHint(QStyle::SH_SpinBox_StepModifier, nullptr, this)); d->reset(); d->updateEditFieldGeometry(); break; |