Revert "QHeaderView: relayout on resetDefaultSectionSize"
This reverts commit a8df174369cecd90f14dac85bf162353b7cb25d1. Reason for revert: Caused QTBUG-122109 Pick-to: 6.6 6.5 Fixes: QTBUG-122109 Fixes: QTBUG-120699 Change-Id: Iea185c00f35e17d8eb8e8da70dc2d808ea274b04 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> (cherry picked from commit c1921abf65092f4732435a92732c8c11224d31fb) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
d47c40d51e
commit
6b0cb98478
@ -1529,14 +1529,13 @@ void QHeaderView::setDefaultSectionSize(int size)
|
|||||||
if (size < 0 || size > maxSizeSection)
|
if (size < 0 || size > maxSizeSection)
|
||||||
return;
|
return;
|
||||||
d->setDefaultSectionSize(size);
|
d->setDefaultSectionSize(size);
|
||||||
d->customDefaultSectionSize = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QHeaderView::resetDefaultSectionSize()
|
void QHeaderView::resetDefaultSectionSize()
|
||||||
{
|
{
|
||||||
Q_D(QHeaderView);
|
Q_D(QHeaderView);
|
||||||
if (d->customDefaultSectionSize) {
|
if (d->customDefaultSectionSize) {
|
||||||
d->setDefaultSectionSize(d->getDefaultSectionSizeFromStyle());
|
d->updateDefaultSectionSizeFromStyle();
|
||||||
d->customDefaultSectionSize = false;
|
d->customDefaultSectionSize = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2388,7 +2387,7 @@ bool QHeaderView::event(QEvent *e)
|
|||||||
break; }
|
break; }
|
||||||
case QEvent::StyleChange:
|
case QEvent::StyleChange:
|
||||||
if (!d->customDefaultSectionSize)
|
if (!d->customDefaultSectionSize)
|
||||||
d->setDefaultSectionSize(d->getDefaultSectionSizeFromStyle());
|
d->updateDefaultSectionSizeFromStyle();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -3855,6 +3854,7 @@ void QHeaderViewPrivate::setDefaultSectionSize(int size)
|
|||||||
executePostedLayout();
|
executePostedLayout();
|
||||||
invalidateCachedSizeHint();
|
invalidateCachedSizeHint();
|
||||||
defaultSectionSize = size;
|
defaultSectionSize = size;
|
||||||
|
customDefaultSectionSize = true;
|
||||||
if (state == QHeaderViewPrivate::ResizeSection)
|
if (state == QHeaderViewPrivate::ResizeSection)
|
||||||
preventCursorChangeInSetOffset = true;
|
preventCursorChangeInSetOffset = true;
|
||||||
for (int i = 0; i < sectionItems.size(); ++i) {
|
for (int i = 0; i < sectionItems.size(); ++i) {
|
||||||
@ -3875,14 +3875,15 @@ void QHeaderViewPrivate::setDefaultSectionSize(int size)
|
|||||||
viewport->update();
|
viewport->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
int QHeaderViewPrivate::getDefaultSectionSizeFromStyle() const
|
void QHeaderViewPrivate::updateDefaultSectionSizeFromStyle()
|
||||||
{
|
{
|
||||||
Q_Q(const QHeaderView);
|
Q_Q(QHeaderView);
|
||||||
return orientation == Qt::Horizontal
|
if (orientation == Qt::Horizontal) {
|
||||||
? q->style()->pixelMetric(QStyle::PM_HeaderDefaultSectionSizeHorizontal, nullptr, q)
|
defaultSectionSize = q->style()->pixelMetric(QStyle::PM_HeaderDefaultSectionSizeHorizontal, nullptr, q);
|
||||||
: qMax(q->minimumSectionSize(),
|
} else {
|
||||||
q->style()->pixelMetric(QStyle::PM_HeaderDefaultSectionSizeVertical, nullptr,
|
defaultSectionSize = qMax(q->minimumSectionSize(),
|
||||||
q));
|
q->style()->pixelMetric(QStyle::PM_HeaderDefaultSectionSizeVertical, nullptr, q));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QHeaderViewPrivate::recalcSectionStartPos() const // linear (but fast)
|
void QHeaderViewPrivate::recalcSectionStartPos() const // linear (but fast)
|
||||||
@ -4191,7 +4192,7 @@ bool QHeaderViewPrivate::read(QDataStream &in)
|
|||||||
if (in.status() == QDataStream::Ok) { // we haven't read past end
|
if (in.status() == QDataStream::Ok) { // we haven't read past end
|
||||||
customDefaultSectionSize = tmpbool;
|
customDefaultSectionSize = tmpbool;
|
||||||
if (!customDefaultSectionSize)
|
if (!customDefaultSectionSize)
|
||||||
defaultSectionSize = getDefaultSectionSizeFromStyle();
|
updateDefaultSectionSizeFromStyle();
|
||||||
}
|
}
|
||||||
|
|
||||||
lastSectionSize = -1;
|
lastSectionSize = -1;
|
||||||
|
@ -148,7 +148,7 @@ public:
|
|||||||
|
|
||||||
inline void setDefaultValues(Qt::Orientation o) {
|
inline void setDefaultValues(Qt::Orientation o) {
|
||||||
orientation = o;
|
orientation = o;
|
||||||
defaultSectionSize = getDefaultSectionSizeFromStyle();
|
updateDefaultSectionSizeFromStyle();
|
||||||
defaultAlignment = (o == Qt::Horizontal
|
defaultAlignment = (o == Qt::Horizontal
|
||||||
? Qt::Alignment(Qt::AlignCenter)
|
? Qt::Alignment(Qt::AlignCenter)
|
||||||
: Qt::AlignLeft|Qt::AlignVCenter);
|
: Qt::AlignLeft|Qt::AlignVCenter);
|
||||||
@ -323,7 +323,7 @@ public:
|
|||||||
void removeSectionsFromSectionItems(int start, int end);
|
void removeSectionsFromSectionItems(int start, int end);
|
||||||
void resizeSectionItem(int visualIndex, int oldSize, int newSize);
|
void resizeSectionItem(int visualIndex, int oldSize, int newSize);
|
||||||
void setDefaultSectionSize(int size);
|
void setDefaultSectionSize(int size);
|
||||||
int getDefaultSectionSizeFromStyle() const;
|
void updateDefaultSectionSizeFromStyle();
|
||||||
void recalcSectionStartPos() const; // not really const
|
void recalcSectionStartPos() const; // not really const
|
||||||
|
|
||||||
inline int headerLength() const { // for debugging
|
inline int headerLength() const { // for debugging
|
||||||
|
@ -4922,6 +4922,7 @@ void tst_QTableView::resetDefaultSectionSize()
|
|||||||
view.verticalHeader()->resetDefaultSectionSize();
|
view.verticalHeader()->resetDefaultSectionSize();
|
||||||
view.show();
|
view.show();
|
||||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||||
|
QEXPECT_FAIL("", "Reverted fix for QTBUG-116013 due to QTBUG-122109", Continue);
|
||||||
QCOMPARE(view.verticalHeader()->logicalIndexAt(9, 45), 1);
|
QCOMPARE(view.verticalHeader()->logicalIndexAt(9, 45), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user