diff options
Diffstat (limited to 'src/widgets/widgets/qabstractscrollarea.cpp')
-rw-r--r-- | src/widgets/widgets/qabstractscrollarea.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/widgets/widgets/qabstractscrollarea.cpp b/src/widgets/widgets/qabstractscrollarea.cpp index 598d173144..5ea8330db2 100644 --- a/src/widgets/widgets/qabstractscrollarea.cpp +++ b/src/widgets/widgets/qabstractscrollarea.cpp @@ -185,7 +185,7 @@ QAbstractScrollAreaScrollBarContainer::QAbstractScrollAreaScrollBarContainer(Qt: orientation(orientation) { setLayout(layout); - layout->setMargin(0); + layout->setContentsMargins(QMargins()); layout->setSpacing(0); layout->addWidget(scrollBar); layout->setSizeConstraint(QLayout::SetMaximumSize); @@ -820,7 +820,7 @@ QWidget *QAbstractScrollArea::cornerWidget() const All widgets set here will be deleted by the scroll area when it is destroyed unless you separately reparent the widget after setting - some other corner widget (or 0). + some other corner widget (or \nullptr). Any \e newly set widget should have no current parent. @@ -1604,8 +1604,10 @@ QSize QAbstractScrollArea::sizeHint() const if (!d->sizeHint.isValid() || d->sizeAdjustPolicy == QAbstractScrollArea::AdjustToContents) { const int f = 2 * d->frameWidth; const QSize frame( f, f ); - const QSize scrollbars(d->vbarpolicy == Qt::ScrollBarAlwaysOn ? d->vbar->sizeHint().width() : 0, - d->hbarpolicy == Qt::ScrollBarAlwaysOn ? d->hbar->sizeHint().height() : 0); + 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; |