QTreeView: take into account the min/max size of the header view
Mimicking what QTableView is already doing correctly, the header's height needs to be constrained by its own minimum/maximum height. Task-number: QTBUG-49277 Change-Id: I695a4398991b738c4b4c924716176b9ad2152e87 Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com> Reviewed-by: David Faure <david.faure@kdab.com>bb10
parent
55f0343a99
commit
4829edfa4e
|
|
@ -2830,10 +2830,14 @@ void QTreeView::updateGeometries()
|
|||
if (d->geometryRecursionBlock)
|
||||
return;
|
||||
d->geometryRecursionBlock = true;
|
||||
QSize hint = d->header->isHidden() ? QSize(0, 0) : d->header->sizeHint();
|
||||
setViewportMargins(0, hint.height(), 0, 0);
|
||||
int height = 0;
|
||||
if (!d->header->isHidden()) {
|
||||
height = qMax(d->header->minimumHeight(), d->header->sizeHint().height());
|
||||
height = qMin(height, d->header->maximumHeight());
|
||||
}
|
||||
setViewportMargins(0, height, 0, 0);
|
||||
QRect vg = d->viewport->geometry();
|
||||
QRect geometryRect(vg.left(), vg.top() - hint.height(), vg.width(), hint.height());
|
||||
QRect geometryRect(vg.left(), vg.top() - height, vg.width(), height);
|
||||
d->header->setGeometry(geometryRect);
|
||||
QMetaObject::invokeMethod(d->header, "updateGeometries");
|
||||
d->updateScrollBars();
|
||||
|
|
|
|||
Loading…
Reference in New Issue