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 <axel.spoerl@qt.io> (cherry picked from commit b5a87a665cbb37a09e9750449f0d2980dd035464) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
c6ae521e5b
commit
8ebe07a76d
@ -27,11 +27,12 @@
|
||||
#include <private/qabstractitemmodel_p.h>
|
||||
#include <private/qabstractitemdelegate_p.h>
|
||||
|
||||
#include <QtCore/private/qnumeric_p.h>
|
||||
#ifndef QT_NO_DATASTREAM
|
||||
#include <qdatastream.h>
|
||||
#endif
|
||||
|
||||
#include <QtCore/q26numeric.h>
|
||||
|
||||
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<int>(d->headerOffset - qint64{newOffset});
|
||||
const int ndelta = q26::saturate_cast<int>(d->headerOffset - qint64{newOffset});
|
||||
d->headerOffset = newOffset;
|
||||
if (d->orientation == Qt::Horizontal)
|
||||
d->viewport->scroll(isRightToLeft() ? -ndelta : ndelta, 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user