diff options
author | Marc Mutz <marc.mutz@qt.io> | 2024-02-14 10:01:30 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2024-03-13 10:23:52 +0000 |
commit | 92eb2f691bb773744a8e427bd13ea32ba39d5078 (patch) | |
tree | 83567ffbaa99ae034b826b34413371f46951bc88 | |
parent | 73c52ba2687c2035a40141f2a5236399f8331f4b (diff) |
QGuiApplication: copy a Prealloc value instead of hard-coding 16
The EventPointMap QPointingDevicePrivate::activePoints is actually a
QVarLengthFlatMap<., ., 20>, not 16, so copy the value instead of just
hard-coding something.
Amends 296ede3aab2c0cc1acd28a2adb3017ac74d7ed6b.
Change-Id: Ic8e83f4095f57be74f7708d5cec6a19971772b76
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 60b6c58b45..094da531ee 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -2934,7 +2934,8 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To // Send the TouchCancel to all windows with active touches and clean up. QTouchEvent touchEvent(QEvent::TouchCancel, device, e->modifiers); touchEvent.setTimestamp(e->timestamp); - QMinimalVarLengthFlatSet<QWindow *, 16> windowsNeedingCancel; + constexpr qsizetype Prealloc = decltype(devPriv->activePoints)::mapped_container_type::PreallocatedSize; + QMinimalVarLengthFlatSet<QWindow *, Prealloc> windowsNeedingCancel; for (auto &epd : devPriv->activePoints.values()) { if (QWindow *w = QMutableEventPoint::window(epd.eventPoint)) |