Details
-
Task
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
5.14.0
-
None
Description
Compile and run sample.cpp attached.
You will see main window with tableview inside. The tableview has small empty space just right of horizontal header. This is due to QAbstractScrollArea::sizeHint() implementation that takes into account virtual vertical scrollbar that can appear instead of that space.
The code is copy/pasted fragment of current implementation in Qt 5.14.0:
QSize QAbstractScrollArea::sizeHint() const
{
Q_D(const QAbstractScrollArea);
if (d->sizeAdjustPolicy == QAbstractScrollArea::AdjustIgnored)
return QSize(256, 192);
if (!d->sizeHint.isValid() || d->sizeAdjustPolicy == QAbstractScrollArea::AdjustToContents)
{ const int f = 2 * d->frameWidth; const QSize frame( f, f ); const bool vbarHidden = d->vbar->isHidden() || d->vbarpolicy == Qt::ScrollBarAlwaysOff; const bool hbarHidden = d->hbar->isHidden() || d->hbarpolicy == Qt::ScrollBarAlwaysOff; const QSize scrollbars(vbarHidden ? 0 : d->vbar->sizeHint().width(), hbarHidden ? 0 : d->hbar->sizeHint().height()); d->sizeHint = frame + scrollbars + viewportSizeHint(); } return d->sizeHint;
}
Is this correct? Uncomment function CTableView::sizeHint() in attached sample.cpp, recompile and run again. You will see that empty space disappeared. Which behavior is more relevant?