From 8ebe07a76dbff99850076c11c05be6fb36b260fe Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 26 Mar 2025 11:25:54 +0100 Subject: [PATCH] QHeaderView: port from qt_saturate to q26::saturate_cast The commit that introduced the qt_saturate call did use that old function in order to stay compatible with Qt 6.5, which never received q26::saturate_cast. This patch ports to the new function in branches that have it. Pick-to: 6.8 Change-Id: Iadd9d2c92ea1e37095b71b1647db61dec2b8333a Reviewed-by: Axel Spoerl (cherry picked from commit b5a87a665cbb37a09e9750449f0d2980dd035464) Reviewed-by: Qt Cherry-pick Bot --- src/widgets/itemviews/qheaderview.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index 90fbf3e1aa3..aa14d397d62 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -27,11 +27,12 @@ #include #include -#include #ifndef QT_NO_DATASTREAM #include #endif +#include + QT_BEGIN_NAMESPACE #ifndef QT_NO_DATASTREAM @@ -417,7 +418,7 @@ void QHeaderView::setOffset(int newOffset) if (d->headerOffset == newOffset) return; // don't overflow; this function is checked with both INT_MIN and INT_MAX... - const int ndelta = qt_saturate(d->headerOffset - qint64{newOffset}); + const int ndelta = q26::saturate_cast(d->headerOffset - qint64{newOffset}); d->headerOffset = newOffset; if (d->orientation == Qt::Horizontal) d->viewport->scroll(isRightToLeft() ? -ndelta : ndelta, 0);