summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qscrollarea.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/widgets/qscrollarea.cpp')
-rw-r--r--src/widgets/widgets/qscrollarea.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/widgets/widgets/qscrollarea.cpp b/src/widgets/widgets/qscrollarea.cpp
index f880240ea7..e8fdadb648 100644
--- a/src/widgets/widgets/qscrollarea.cpp
+++ b/src/widgets/widgets/qscrollarea.cpp
@@ -203,10 +203,13 @@ void QScrollAreaPrivate::updateScrollBars()
if (vbarpolicy == Qt::ScrollBarAsNeeded) {
int vbarWidth = vbar->sizeHint().width();
QSize m_hfw = m.expandedTo(min).boundedTo(max);
- while (h > m.height() && vbarWidth) {
- --vbarWidth;
- --m_hfw.rwidth();
- h = widget->heightForWidth(m_hfw.width());
+ // is there any point in searching?
+ if (widget->heightForWidth(m_hfw.width() - vbarWidth) <= m.height()) {
+ while (h > m.height() && vbarWidth) {
+ --vbarWidth;
+ --m_hfw.rwidth();
+ h = widget->heightForWidth(m_hfw.width());
+ }
}
max = QSize(m_hfw.width(), qMax(m_hfw.height(), h));
}