summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2022-09-28 21:25:53 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2022-09-29 17:17:04 +0200
commit87cabd0b92bc348f73be2fe0a20a57fa485f6665 (patch)
tree0ba9444c8b937900c3a759e703686f169884252b /src/widgets/widgets
parentff4e624cd6b4320314ea93d142c707732cb01d4a (diff)
Add QStyleHints::keyboardAutoRepeatRateF()
The keyboardAutoRepeatRate() function returning an int assumes the rate can not be lower than one event per second, but this is not always the case, e.g. on macOS where the slowest setting for key repeat results in a two second delay between events. Change-Id: I806fb57883ce0085c835fb0a43d6b86bd6da375a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/widgets/widgets')
-rw-r--r--src/widgets/widgets/qabstractspinbox.cpp2
-rw-r--r--src/widgets/widgets/qabstractspinbox_p.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp
index ff41a72fca..b0552008b5 100644
--- a/src/widgets/widgets/qabstractspinbox.cpp
+++ b/src/widgets/widgets/qabstractspinbox.cpp
@@ -1236,7 +1236,7 @@ void QAbstractSpinBox::timerEvent(QTimerEvent *event)
killTimer(d->spinClickThresholdTimerId);
d->spinClickThresholdTimerId = -1;
d->effectiveSpinRepeatRate = d->buttonState & Keyboard
- ? QGuiApplication::styleHints()->keyboardAutoRepeatRate()
+ ? QGuiApplication::styleHints()->keyboardAutoRepeatRateF()
: d->spinClickTimerInterval;
d->spinClickTimerId = startTimer(d->effectiveSpinRepeatRate);
doStep = true;
diff --git a/src/widgets/widgets/qabstractspinbox_p.h b/src/widgets/widgets/qabstractspinbox_p.h
index be91917832..efc23586cf 100644
--- a/src/widgets/widgets/qabstractspinbox_p.h
+++ b/src/widgets/widgets/qabstractspinbox_p.h
@@ -102,7 +102,7 @@ public:
int spinClickTimerInterval = 100;
int spinClickThresholdTimerId = -1;
int spinClickThresholdTimerInterval = -1;
- int effectiveSpinRepeatRate = 1;
+ qreal effectiveSpinRepeatRate = 1;
int acceleration = 0;
int wheelDeltaRemainder = 0;