diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2021-10-05 15:47:06 +0200 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2021-10-08 00:45:18 +0200 |
commit | e0b6b27d397faac924751be8da2c781286c3f8d7 (patch) | |
tree | cb35796de0d7e15b20919b6d5f228e5fdca78d7a /src/widgets/styles/qstyle.cpp | |
parent | e4a09b0194f5be39dfb445bbc5722410ed7bd9dc (diff) |
Add style hint for preventing spin box selection on up/down
On a mobile device, selecting text in a line edit brings up the text
action popup for select/copy/cut. In a spinbox where the user changes the
value using the buttons, this can be very irritating, without providing
any usability - the user is unlikely to start typing, at least not
without first transferring focus into the lineedit first to bring up the
keyboard.
This style hint allows styles to override the default behavior of
QAbstractSpinBox. Implement the customization for the Android style, and
add a test case for QSpinBox.
[ChangeLog][QtWidgets][QStyle] A new style hint, SH_SpinBox_SelectOnStep,
specifies whether pressing the up/down buttons or keys in a spinbox will
automatically select the text.
Fixes: QTBUG-93366
Change-Id: If06365a7c62087a2213145e13119f56544ac33b5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/widgets/styles/qstyle.cpp')
-rw-r--r-- | src/widgets/styles/qstyle.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
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. |