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>
This commit is contained in:
Marc Mutz 2024-02-14 10:01:30 +01:00
parent 73c52ba268
commit 92eb2f691b

View File

@ -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))