diff options
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/styles/qcommonstyle.cpp | 3 | ||||
-rw-r--r-- | src/widgets/styles/qstyle.cpp | 4 | ||||
-rw-r--r-- | src/widgets/styles/qstyle.h | 1 | ||||
-rw-r--r-- | src/widgets/widgets/qabstractspinbox.cpp | 3 |
4 files changed, 10 insertions, 1 deletions
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 6f6ddfec44..cdd061f8d5 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -5393,6 +5393,9 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget case SH_TabBar_AllowWheelScrolling: ret = true; break; + case SH_SpinBox_SelectOnStep: + ret = true; + break; default: ret = 0; break; diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp index 8946b9d90e..b901b4b08e 100644 --- a/src/widgets/styles/qstyle.cpp +++ b/src/widgets/styles/qstyle.cpp @@ -1853,6 +1853,10 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, spinbox mouse clicks. \value SH_SpinBox_ClickAutoRepeatThreshold Auto-repeat threshold for spinbox mouse clicks. + \value SH_SpinBox_SelectOnStep Whether changing the value using + the buttons or up/down keys automatically selects the text. This enum + value has been introduced in Qt 6.3. + \value SH_ToolTipLabel_Opacity An integer indicating the opacity for the tip label, 0 is completely transparent, 255 is completely opaque. diff --git a/src/widgets/styles/qstyle.h b/src/widgets/styles/qstyle.h index 6d094cc4f2..03f6fc1562 100644 --- a/src/widgets/styles/qstyle.h +++ b/src/widgets/styles/qstyle.h @@ -737,6 +737,7 @@ public: SH_SpinBox_StepModifier, SH_TabBar_AllowWheelScrolling, SH_Table_AlwaysDrawLeftTopGridLines, + SH_SpinBox_SelectOnStep, // Add new style hint values here SH_CustomBase = 0xf0000000 diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp index fc01354046..d49483db69 100644 --- a/src/widgets/widgets/qabstractspinbox.cpp +++ b/src/widgets/widgets/qabstractspinbox.cpp @@ -671,7 +671,8 @@ void QAbstractSpinBox::stepBy(int steps) } else if (e == AlwaysEmit) { d->emitSignals(e, old); } - selectAll(); + if (style()->styleHint(QStyle::SH_SpinBox_SelectOnStep, nullptr, this, nullptr)) + selectAll(); } /*! |