QHeaderView: rename private 'offset' to avoid clash with QAIVP::offset()

QAIVP has a function named 'offset()' which is hidden by QHVP::offset
variable. Therefore rename the QHVP::offset to headerOffset

Pick-to: 6.5
Change-Id: Iadb18b8f18197925daa72af243483a044c1d94e7
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 15884aba8fc697ce3c2b9b5f7dea14093f037f03)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 13198306c8a64cc4a1d17f028aac744437c773b7)
This commit is contained in:
Christian Ehrlicher 2023-12-15 20:41:09 +01:00 committed by Qt Cherry-pick Bot
parent 93ed05edfa
commit c507e2f33e
2 changed files with 14 additions and 14 deletions

View File

@ -418,7 +418,7 @@ Qt::Orientation QHeaderView::orientation() const
int QHeaderView::offset() const int QHeaderView::offset() const
{ {
Q_D(const QHeaderView); Q_D(const QHeaderView);
return d->offset; return d->headerOffset;
} }
/*! /*!
@ -432,10 +432,10 @@ int QHeaderView::offset() const
void QHeaderView::setOffset(int newOffset) void QHeaderView::setOffset(int newOffset)
{ {
Q_D(QHeaderView); Q_D(QHeaderView);
if (d->offset == (int)newOffset) if (d->headerOffset == newOffset)
return; return;
int ndelta = d->offset - newOffset; int ndelta = d->headerOffset - newOffset;
d->offset = newOffset; d->headerOffset = newOffset;
if (d->orientation == Qt::Horizontal) if (d->orientation == Qt::Horizontal)
d->viewport->scroll(isRightToLeft() ? -ndelta : ndelta, 0); d->viewport->scroll(isRightToLeft() ? -ndelta : ndelta, 0);
else else
@ -591,7 +591,7 @@ int QHeaderView::visualIndexAt(int position) const
if (d->reverse()) if (d->reverse())
vposition = d->viewport->width() - vposition - 1; vposition = d->viewport->width() - vposition - 1;
vposition += d->offset; vposition += d->headerOffset;
if (vposition > d->length) if (vposition > d->length)
return -1; return -1;
@ -681,7 +681,7 @@ int QHeaderView::sectionViewportPosition(int logicalIndex) const
int position = sectionPosition(logicalIndex); int position = sectionPosition(logicalIndex);
if (position < 0) if (position < 0)
return position; // the section was hidden return position; // the section was hidden
int offsetPosition = position - d->offset; int offsetPosition = position - d->headerOffset;
if (d->reverse()) if (d->reverse())
return d->viewport->width() - (offsetPosition + sectionSize(logicalIndex)); return d->viewport->width() - (offsetPosition + sectionSize(logicalIndex));
return offsetPosition; return offsetPosition;
@ -2520,9 +2520,9 @@ void QHeaderView::paintEvent(QPaintEvent *e)
for (int a = 0, i = 0; i < d->sectionItems.count(); ++i) { for (int a = 0, i = 0; i < d->sectionItems.count(); ++i) {
QColor color((i & 4 ? 255 : 0), (i & 2 ? 255 : 0), (i & 1 ? 255 : 0)); QColor color((i & 4 ? 255 : 0), (i & 2 ? 255 : 0), (i & 1 ? 255 : 0));
if (d->orientation == Qt::Horizontal) if (d->orientation == Qt::Horizontal)
painter.fillRect(a - d->offset, 0, d->sectionItems.at(i).size, 4, color); painter.fillRect(a - d->headerOffset, 0, d->sectionItems.at(i).size, 4, color);
else else
painter.fillRect(0, a - d->offset, 4, d->sectionItems.at(i).size, color); painter.fillRect(0, a - d->headerOffset, 4, d->sectionItems.at(i).size, color);
a += d->sectionItems.at(i).size; a += d->sectionItems.at(i).size;
} }
@ -2624,7 +2624,7 @@ void QHeaderView::mouseMoveEvent(QMouseEvent *e)
if (visual == 0 && logicalIndex(0) == 0 && !d->allowUserMoveOfSection0) if (visual == 0 && logicalIndex(0) == 0 && !d->allowUserMoveOfSection0)
return; return;
const int posThreshold = d->headerSectionPosition(visual) - d->offset + d->headerSectionSize(visual) / 2; const int posThreshold = d->headerSectionPosition(visual) - d->headerOffset + d->headerSectionSize(visual) / 2;
const int checkPos = d->reverse() ? d->viewport->width() - pos : pos; const int checkPos = d->reverse() ? d->viewport->width() - pos : pos;
int moving = visualIndex(d->section); int moving = visualIndex(d->section);
int oldTarget = d->target; int oldTarget = d->target;
@ -2648,7 +2648,7 @@ void QHeaderView::mouseMoveEvent(QMouseEvent *e)
return; return;
} }
case QHeaderViewPrivate::SelectSections: { case QHeaderViewPrivate::SelectSections: {
int logical = logicalIndexAt(qMax(-d->offset, pos)); int logical = logicalIndexAt(qMax(-d->headerOffset, pos));
if (logical == -1 && pos > 0) if (logical == -1 && pos > 0)
logical = logicalIndex(d->lastVisibleVisualIndex()); logical = logicalIndex(d->lastVisibleVisualIndex());
if (logical == d->pressed) if (logical == d->pressed)
@ -3070,7 +3070,7 @@ int QHeaderView::horizontalOffset() const
{ {
Q_D(const QHeaderView); Q_D(const QHeaderView);
if (d->orientation == Qt::Horizontal) if (d->orientation == Qt::Horizontal)
return d->offset; return d->headerOffset;
return 0; return 0;
} }
@ -3085,7 +3085,7 @@ int QHeaderView::verticalOffset() const
{ {
Q_D(const QHeaderView); Q_D(const QHeaderView);
if (d->orientation == Qt::Vertical) if (d->orientation == Qt::Vertical)
return d->offset; return d->headerOffset;
return 0; return 0;
} }

View File

@ -37,7 +37,7 @@ public:
QHeaderViewPrivate() QHeaderViewPrivate()
: state(NoState), : state(NoState),
offset(0), headerOffset(0),
sortIndicatorOrder(Qt::DescendingOrder), sortIndicatorOrder(Qt::DescendingOrder),
sortIndicatorSection(0), sortIndicatorSection(0),
sortIndicatorShown(false), sortIndicatorShown(false),
@ -219,7 +219,7 @@ public:
enum State { NoState, ResizeSection, MoveSection, SelectSections, NoClear } state; enum State { NoState, ResizeSection, MoveSection, SelectSections, NoClear } state;
int offset; int headerOffset;
Qt::Orientation orientation; Qt::Orientation orientation;
Qt::SortOrder sortIndicatorOrder; Qt::SortOrder sortIndicatorOrder;
int sortIndicatorSection; int sortIndicatorSection;